![]() ![]() SNS has limitation of 300 publish/Second, to achieve same performance as MSK, there need to have higher number of SNS topic for same purpose. MSK has better scalability option because of inherent design of partitions that allow parallelism and ordering of message. Please find out some of specific difference between two MSK VS SQS+SNS is not really 1:1 comparison. Callers are able to request a sender/receiver for a specific queue/topic/subscription and they'll be created as needed and then pooled for reuse. This ensures that clients are pooled and their lifetimes are managed correctly, while also giving flexibility to callers to hold onto the sender/receiver reference and use for multiple operations rather than paying the cost to retrieve it.Īs an example, the following is a simple factory class that you'd create and manage as a singleton in your application. To add some additional context, I'd advise not wrapping Service Bus operations but, instead, have a factory that focuses on managing clients and letting callers interact directly with them. The sync-over-async pattern that you're using is going to put additional pressure on the thread pool and is likely to result in thread starvation and/or deadlocks under load. I'd also very strongly recommend refactoring your class to be async. When your application closes, be sure to close or dispose the ServiceBusClient, which will ensure that all of its child senders/receivers are also cleaned up appropriately. Each call to SendMessage or ReceiveMessage should for a given queue should use the same sender/receiver instance. I'd recommend pooling your senders/receivers and keeping each as a singleton for the associated queue. This is going to orphan the AMQP link until the service force-closes it for being idle after 20 minutes. In your code, you're also implicitly abandoning the senders/receivers without closing them. They're intended to be long-lived and reused over the lifetime of the application. Generally, you want to avoid the pattern of creating short-lived Service Bus client objects. ![]() In your code, you're creating a new receiver for ReceiveMessage call - so when you attempt to complete or abandon the message, you're using a link for which the message is not valid if any other call to ReceiveMessage has taken place. For the SDK, this means that you must settle the message with the same ServiceBusReceiver instance that you used to receive it. Service Bus associates a message lock with the AMQP link from which the message was received. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |