Getting IMessageSession into OnMessageSentToErrorQueue callback

Hi all,

I’m trying to send an event message when certain messages fail for the last time (going to error queue). I’ve read in other posts that I could leverage OnMessageSentToErrorQueue with a callback.

My current setup is a console service that uses .net standard IoC and calls UseNServiceBus inside Host.CreateDefaultBuilder to set everything up. I have no idea how to get the IMessageSession to the error handling callback with this configuration. All examples I’ve seen show a simple setup not using IoC where the endpoint is configured and started in the same class.

Any help would be appreciated. Thanks.

Hi @Bill_Staff,

you can use my very simple NServiceBus.Extensions.EndpointStarted addon to capture the message session instance.

Let me know if that helps.
.m

1 Like

That looks like it did the trick.
Thank you.

1 Like

Hi @mauroservienti

It looks like this package is not yet compatible with NServiceBus 8. Any plans to release an update?

Kind Regards,
J

Hi @jordan_n,

Thanks for the heads up. I just released a new version (2.0) supporting NServiceBus 8. It should be on NuGet as soon as the package indexing is complete.

1 Like

Thank you @mauroservienti !!!