Disclaimer: I just joined StackOverflow and am a member of Solace, a pioneer in the EDA & Event-enablement space.
This is a classic pubsub problem that is well served using any JMS Brokers, or a Solace or Kafka Broker for better QoS.
Making few assumptions - request is triggered from a UI with the expectation of presenting responses in near real-time as they arrive from the partners. The UI refresh can be left alone at the hands of a good frontend framework/stack of your choice - the crux of the matter is around how this is handled in the backend.
An event-driven design will serve great for this requirement - the flow would look like this:
- Publish a request message to topic TRAVEL_DESTINATION_REQUEST with "reply-to" set to a Queue TRAVEL_DESTINATION_RESPONSE
- Subscribers (partners) subscribe to the topic TRAVEL_DESTINATION_REQUEST and send their response to the "reply-to" destination
- Publisher, parallelly runs a thread (or callback) checking for the arrival of response messages on the TRAVEL_DESTINATION_RESPONSE queue and take appropriate action (push it to the client, persist in a DB, or something like that) ensuring that all responses are processed
Almost any Broker can handle this use case - however, the complexity arises when you want to handle several such requests simultaneously without mixing responses, without proliferation of topics, queues and consuming services, resulting in resource overrun and management overhead.
Here is a possible solution using Solace as the EDA Broker. Solace's TOPIC scheme is unique and is well-suited for this requirement. The topic is not just a name, rather a scheme that can encode dynamic details as levels in the topic name that can be useful while processing the message. Solace topics are hierarchical allowing can use wildcards to filter based on different levels in a topic.
With Solace and its hierarchical topics - we can manage this as follows:
- Publish requests on topics TRAVEL_DESTINATION_REQUEST/ and set the reply-to destination as RESPONSE_QUEUE
- All the partners subscribe to the topic with wildcard TRAVEL_DESTINATION_REQUEST/* so that they receive all travel request messages
- Either the publisher itself or a separate service could connect to the RESPONSE_QUEUE and retrieve the responses
The last step (3) is where the most benefit of topic-hierarchy comes into play. You can create multiple, simultaneous client connections to the queue RESPONSE_QUEUE and have a distinct subscription for each connection - it would be like spawning a consumer service for every single published request-id, which in turn connects to the queue and subscribes for a response topic TRAVEL_DESTINATION_RESPONSE/.
After some time or a logical condition, these consumer services can exit marking the completion of request processing. As to what happens inside this service, it is the business logic - persist into a DB or push it to the frontend or something else.
Hope this lays out an approach using Solace as the Broker for your requirement. I am sure, other options are available and valid, I am just sharing an efficient approach based on Solace Broker.