-
Notifications
You must be signed in to change notification settings - Fork 84
Multicast Request Response
Imagine you have a number of different types of services in your system that can respond to a particular request and you want to aggregate all the responses.
An example is a credit card payment gateway with a need to do fraud detection. We may have a number of services each optimised to detect different patterns of fraudulent transactions and each return a score to the calling application so it can determine a final threat score.
We call this a Multicast Request Response. We make a Request on the bus with a timeout. After the specified time we collect all the responses.
To make the request on the bus we implement an IBusRequest as we saw in the simple Request Response example. This might look like:
public class FraudulentCardRequest : IBusRequest<FraudulentCardRequest, IsThisDodgyResponse>
{
}
And then we make a MulticastRequest on the bus and await the IEnumerable collection of responses.
var response = await bus.MulticastRequest(request, TimeSpan.FromSeconds(1));
To implement the handler to fulfil this request we implement IHandleMulticastRequest handler class, similar to how he would implement IHandleRequest for a simple Request Response.
Azure Service Bus
Windows Service Bus
Redis
In Process
Configuring Nimbus With Autofac
Configuring Nimbus With Windsor
Configuring Nimbus With Ninject
Sending a Command on the Bus
Publishing an Event on the Bus
Request Response
Multicast Request Response
Multicast Request Response - take First
Large Message Support