I need to establish two-way communication between publisher and subscriber. This is done in order to facilitate an external MVC3 application that defines a subscription with a correlation filter, and then puts the message in the subject. Finally, the MVC3 controller calls BeginReceive () in the SubscriptionClient and waits for a response.
The problem is creating and deleting these Subscription objects. The overhead is huge, and it slows down the application when scanning. This is not to mention the various restrictions on the work, such as no more than 2000 subscriptions on the topic.
What is the best practice for establishing such two-way communication between publisher and subscriber? We want the MVC3 application to post a message, and then wait for a response to that exact message (via the CorrelationId and CorrelationFilter property). We already cache NamespaceManager and MessagingFactory, because they are also overly expensive in terms of resources, and also because we were told that the service bus uses an explicit provisioning model in which we must first create most of these things during the role launch.
Thus, this leaves us with the task of matching the response request and having this huge overhead of creating and deleting a subscription. What is a better practice? Should we keep the subscribers cache and change the filter every time? What do everyone else do? I need to have request throughput of the order of 5-10 thousand MVC3 requests per second through a web role cluster. We already use AsyncController and use asynchronous BeginReceive () for SubscriptionClient. It seems like creating and deleting the signatures of thousands that are suffocating at this point.
Update1:
Based on the great tip here, we updated this solution to maintain the cache of SubscriptionClient objects in every instance of the web role. In addition, we have moved to a MessageSession-oriented approach.
. , AcceptMessageSession() - . MessageSession ? MessageSession ? , Subscription?
. , . : (), CreateSubscription(), CreateSubscriptionClient(), BeginReceive() , . , , , , , .
, , . , MessageSession ? , , MessageSession, / HTTP, , MessageSession .
UPDATE2:
, MessageSession , , LockDuration . , LockDuration 5 . , , pub/sub , . , Azure Tables.
/
Service Bus - . , , , /, . , , , MessageSessions AcceptMessageSession() BeginAcceptMessageSession() , .
- , .