I'm attempting to create a messaging layer on top of the Service Bus .NET client library, giving me the ability to switch Service Bus out for something else if needed.
In my "receiver" class I can use the MessagingFactory's CreateMessageReceiver method to get a generic MessageReceiver that will work for both queues and subscriptions. My class can just be given the entity path and the MessagingFactory figures it out. However, from what I can tell, this generic receiver cannot deal with session-enabled queues and subscriptions - I must use a QueueClient or SubscriptionClient object to accept sessions.
Is there a way to receive from sessions without using a QueueClient or SubscriptionClient object?
The MessageSession
is an equivalent of a MessageReceiver
so from a processing perspective you can have a abstraction that takes in a MessageReceiver
or a MessageSession
. The way these are obtained is indeed different from the MessagingFactory.CreateMessageReceiver
approach since you need to invoke that from a QueueClient
or SubscriptionClient
because the MessagingFactory.AcceptMessageSession
does NOT take a URI path but actually returns sessions from the entire namespace (supported on with Service Bus on premise).