Service Callback (Service Messaging Patterns)
How can a service communicate asynchronously with its consumers?
When a service needs to respond to a consumer request through the issuance of multiple messages or when service message processing requires a large amount of time, it is often not possible to communicate synchronously.
A service can require that consumers communicate with it asynchronously and provide a callback address to which the service can send response messages.
A callback address generation and message correlation mechanism needs to be incorporated into the messaging framework and the overall inventory architecture.
Asynchronous communication can introduce reliability concerns and can further require that surrounding infrastructure be upgraded to fully support the necessary callback correlation.
ArchitectureInventory, Service, Composition
Service A sends a message containing the callback address and correlation information to Service B (1). While Service B is processing the message, Service A is unblocked (2). Service B, at some later point in time, sends a response containing the correlation information to the callback address to Service A (3). While Service B retains this callback address, it can continue to issue subsequent response messages to Service A.