NServiceBus.Host - How do I add the endpoint instance to my IoC container

后端 未结 1 1205
[愿得一人]
[愿得一人] 2021-01-24 02:07

I\'m trying to upgrade a solution from NServiceBus 5 to 6. Currently, we are injecting IBus to a service class so that the service can send messages to the bus as needed. Now

相关标签:
1条回答
  • 2021-01-24 02:15

    Use an IWantToRunWhenEndpointStartsAndStops implementation to inject the IMessageSession for your service class after the bus has started.

    Here is the relevant section from the Upgrade Guide for NServiceBus.Host: https://docs.particular.net/nservicebus/upgrades/host-6to7#iwanttorunwhenendpointstartsandstops-interface-in-version-7-of-nservicebus-host

    An alternative would be to switch to the NServiceBus Windows Service Bootstrap instead of using NServiceBus.Host where you will have more control over the endpoint's lifecycle.

    0 讨论(0)
提交回复
热议问题