0
votes

I want to use a Mass Transit send observer to send certain messages to an Azure service bus queue to be picked up by a IConsumer that log user events to database. The problem is that the send observer is connected to the busControl in a class BusFactory, so when I try to inject the BusFactory to the SendObserver, it creates a circular dependency... I'm pretty new to both Azure service bus, so I might be doing this the wrong way. But is there a way to fire messages from observers? I know consumeContext has a Send() method, but can't find anything similar with SendObservers.

1

1 Answers

3
votes

So, you want to use a send observer to send a message to Azure Service Bus when a message is sent? And then, send a message to Azure Service Bus logging that a message was sent. And then, send a message to Azure Service Bus logging that a message was sent. And then, send a message to Azure Service Bus logging that a message was sent. And then, send a message to Azure Service Bus logging that a message was sent.

Short answer, you can't use the same bus instance. If you want to send log information to Azure Service Bus about messages sent to Azure Service Bus, you would need to use two separate bus instances. Otherwise, you're going to fall into a death spiral of unspeakable recursion and never get out of it.