Martini Services Inputs & Outputs
Defining input and output properties for services is a crucial aspect of service development, providing flexibility and control over the data your service receives and sends. While not mandatory, most services will specify at least one input or output to fulfill their intended functionality.
Injectable Input Properties
Services designed to be invoked over HTTP or integrated within specific endpoints can accept additional, injectable input properties. These properties enhance the service's ability to interact with the context of its invocation, such as details about the HTTP request or information about the service's deployment package.
To make use of injectable input properties, declare the necessary variables explicitly in your service definition. It's important to adhere to naming conventions expected by the platform to ensure the runtime environment correctly injects the desired values.
Common Injectable Input Variables
- HTTP Request Details: An object representing the HTTP request that initiated the service call. This includes method type, headers, URI parameters, and payload.
- Service Package Details: An object containing metadata and contextual information about the package that includes the service.
Additional injectable inputs may include parameters relevant to the service's operational context, such as endpoint-specific arguments or values injected by the runtime environment based on the service's configuration or the nature of the invocation.
Injecting Input Properties
To inject input properties into your service: 1. Declare the necessary variables as part of your service's input specification. This can typically be done through a designated interface or configuration view within your development environment. 2. Use appropriate naming conventions for your variables, which may include specific prefixes or naming patterns required by the platform. 3. Once declared, these variables can be mapped to or from the service's logic, allowing you to utilize the injected values within your service's operations.
By following these steps, you can effectively utilize input properties to enhance the functionality and flexibility of your services, making them more responsive to the context in which they are invoked.
Remember, the precise method for declaring and using these injectable properties will depend on the development tools and runtime environment provided by your integration platform. Always refer to the specific documentation and guidelines provided for the best practices and detailed instructions.