Saga not found handler


(Bheesham Kumar) #1

I am learner in NServiceBus. I create a one process using nservice bus Saga.
Its successfully inserting data in Database(sqlserver ).
After inserting the data its throwing a message SagaNotFound hander how to handle this.
I also gone through this link:
but not sure how to handle this.
please guide.

(Dennis van der Stelt) #2

I’m not really sure what you mean with "after inserting it throws"
Could you explain your scenario a little more detailed, please? What you’re doing and what exactly happens? What messages are involved, etc.

Also, at the bottom of the documentation you mentioned, about IHandleSagaNotFound interface, there is a sample. Did you download the same and have a look at it?

(Ross Sandford) #3

This will be where you implement a new class that implements the IHandleSagaNotFound interface. This interface has its own Handle method, which is where you specify your own code that will act whenever a saga is not found for the relevant message that forms part of that saga. Here is an example implementation of this interface, that simply logs when a saga cannot be found for a message:

public class SagaNotFoundHandler : IHandleSagaNotFound
public void Handle(object message)
if (message is ACertainMessage)
Logger.Info(“Saga not found for ACertainMessage, as the saga is already closed.”);