Hi @pinggi
Although IMessageHandlerContext
might look similar to ASP.NET’s context, it actually is meant to sit in a different layer. The message handlers (classes that implement IHandleMessages
) are meant to be your application services layer. There is usually not gain in abstracting the message handling context and creating another class for the application service.
Another thing that I noticed is that you are using Sagas but you don’t actually make use of Saga data much. NServiceBus Sagas can be used in two ways, either as process managers or as way of implementing your aggregates. In your booking example, you could have a BookingSaga
that is itself a booking aggregate and contains all that information. Your BookingLogic()
would be part of the saga data class, not a separate class.
Alternatively, if you don’t like implementing aggregates through sagas, I would recommend you to not use sagas here but just make your BookingService
handle all the messages. You won’t have access to the Timeout
API but you can instead send a delayed message to yourself.