I am using MassTransit and RabbitMQ in both a "competing consumers" model and a Pub/Sub model.
3 tiers, 1st tier = UI, 2nd tier = gateway, 3rd tier = many distributed services
I have a working competing consumers model but I wish to do the following with Pub/Sub:
The gateway service publishes a message that all connected subscriber instances consume and then respond to to the gateway. The gateway doesn't respond to the UI until all its 3rd tier have responded, the gateway accumulates the response and finally passes back to the UI.
I cannot find a way to inspect MassTransit (whether I use SAGAs or not) in the 2nd tier to know how many subscribers i have in the 3rd tier (to work out if they've all responded). The overall goal is that the UI gets a single response with the accumulated results from the 3rd tier.
A similar question is here - no answers as yet.
UPDATE
Effectively I want to count the number of sinks on the inboundPipeline. Should I be doing this and is there a clean way to do it?
Pub/Sub in general doesn't allow you to know how many consumers for a given message exist. The whole idea is that you aren't coupled to that answer.
To do this, you need to build the solution into your application to keep track of that. When a consume comes up, publish a message for the gateway to register with it. When it shutdowns, do the same to remove that registration.