A few months ago (when I was new to Azure Queues and the SDK tools out there) I Googled "how do I do this" and "how do I do that"... here is where I am today:
I'm using a QueueClient
(Microsoft.ServiceBus.Messaging - Microsoft.ServiceBus.dll) to receive messages from an Azure Queue.
In my same program I'm also using a MessageSender
(from the same namespace and dll) to send messages to the Azure Queue.
My program has to track a Dictionary<string, QueueClient>
and a Dictionary<string, MessageSender>
- which is more complicated than it should be.
Now that I'm more familiar with the Azure SDKs... I realize that the QueueClient
class can both send and receive... So why am I keeping track of 2 objects when the first one can do both?
Is there any reason to use the MessageSender
class instead of the QueueClient
class?
If I need to send and receive, shouldn't I just use the QueueClient
class?
OK - I should have just reflected the DLL first... found the answer.
QueueClient
is a class that simply has a MessageSender
object and a MessageReceiver
object inside of it. So the answer is "No, you should not have 2 objects to do the same thing".
public void Send(BrokeredMessage message)
{
this.ThrowIfSenderNull("Send");
this.InternalSender.Send(message);
}
The "InternalSender" object above is of type MessageSender
.