Question

In NServiceBus 3.0.3 I have written a saga. Based on what I'm seeing in the CQRS paradigm, when we see past tense, that should coincide with an event. I want to make sure I don't have business logic in my saga. My assumption in building the saga is that it would receive events and issue commands based on the event that came in as well as certain data elements stored on the saga. The issue I'm running into is that the Saga by default cannot subscribe to published events. I've tried in the EndPointConfig setting up the IWantToRunAtStartup and in the Run method executing

Bus.Subscribe<CustomerBilledEvent>();  

I've tried creating a handler in the same assembly with saga and still no dice.

My app.config for both the saga (hosted by Nservicebus.host.exe) and the publisher (a service in a console application) both have the message endpoints configured as such

 <add Messages="Events.CustomerBilledEvent, Events" Endpoint="orderservice"/>

IHandleMessages has been configured on the Saga as well as the mapping has been configured on the orderid.

IHandleMessages<CustomerBilledEvent>

ConfigureMapping<CustomerBilledEvent>(s => s.OrderId, m=> m.OrderId);

I'm a little lost as to why I can't get the Saga to subscribe to this event. I understand they do not auto subscribe by default but when I look at samples under Udi and John's blogs, I see past tense being sent (IEvent?) to the saga and them issuing Bus.Send which I infer to be commands (ICommand).

Was it helpful?

Solution

So the problem is that you've set it up that your saga is trying to subscribe to the "orderservice" endpoint to be notified about the CustomerBilledEvent, but that endpoint isn't publishing it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top