I have a microservice group with an exposed search API that serves a client application. I want to "transmit" in real time the aggregate results of a complex search. The search will be expelled by the client that calls the search API, which in turn adds a message to a queue. This will be collected by an Orchestrator service that, in turn, will make calls to 1 or several associated APIs.
My search API has a signalR concentrator that transmits the search results in a similar way to this example. My question is what are some of the messaging strategies to deliver new elements from the orchestrator to the hub flow of the search API?
I have thought of two possibilities (no doubt there are many more)
- The orchestrator loads elements into a cache memory which in turn is consulted by the search API and the new elements added to the sequence.
- The orchestrator adds elements to a response message queue, the search API listens and adds new elements to the sequence.
Which idea sounds more reasonably?
My idea was to have a correlation ID for the search and response elements, which simplified the implementation of the cache and, possibly, a little easier to scale horizontally.
For the answer queue, I'm not sure how I would listen to only the elements that you want for this request / subprocess. Probably more than one implementation detail, I'm not sure.