Skip to main content

Service Activator

Use a Service Activator to expose the same application operation through a message channel and a direct service interface.

The pattern is implemented by keeping the business operation in a reusable function and placing thin protocol-specific adapters around it. A service resource handles non-messaging callers, while a broker listener activates the same function when a message arrives.

Request-reply service activation

Use request-reply service activation when a message sender expects the activated service to return a result. Define typed request and response records, implement the operation as a reusable function, and call that function from both the direct resource function and the broker request handler.

  1. Define the request and response records in Types.
  2. Add the reusable operation as a Function and select Make visible across the project when the function must be called from multiple artifacts.
  3. Create an HTTP service for non-messaging callers.
  4. Add a resource function with the typed request payload and add a Call Function step that invokes the reusable operation.
  5. Add a RabbitMQ event integration for message-based callers.
  6. Configure the RabbitMQ queue and listener values with configurable variables.
  7. Add the onRequest handler from RabbitMQ event handlers, define the expected message content, add a Call Function step, and return the function result.

One-way command activation

Use one-way command activation when the message channel only needs to trigger the operation and does not need a service result in the reply path. The broker handler validates the message content, calls the shared function, and lets the handler return successfully after the command is accepted.

  1. Reuse the request and response records from Types.
  2. Reuse the same Function that contains the application operation.
  3. Add a RabbitMQ event integration for the command queue.
  4. Configure the listener, queue, and authentication fields with configurable variables.
  5. Add the onMessage handler from RabbitMQ event handlers and define the expected message content.
  6. In the handler flow, add a Call Function step for the shared operation and add any flow-level error handling required by the command contract.