英文:
Purpose of Batch Operations (enableBatchedOperations) in Topic/Subs in Azure Service Bus?
问题
"enableBatchedOperations"是一种设置,用于启用或禁用批量操作。在您提供的代码中,您已将批量操作禁用在主题和订阅级别,如下所示:
TopicDescription td = new TopicDescription(topicName);
td.setEnableBatchedOperations(false);
managementClient.createTopic(td);
SubscriptionDescription sd1 = new SubscriptionDescription(topicName, subOne);
sd1.setEnableBatchedOperations(false);
managementClient.createSubscription(sd1, somerule);
尽管如此,您仍然能够使用TopicClient.sendBatch(Collection<? extends IMessage> messages)
方法以批处理模式发送消息,并且能够使用IMessageReceiver.receiveBatch(int maxMessageCount)
从每个订阅中读取消息。这可能是因为批量操作的启用状态可能影响的不仅仅是消息的发送和接收方式,还可能包括底层的管理操作。
"enableBatchedOperations"的具体目的可能因不同的消息队列服务而异,但通常情况下,它允许将多个操作组合成批次,以提高性能和效率。但是,是否允许批量操作以及它们如何影响发送和接收消息以及管理操作可能因消息队列服务的实现而异。
如果您仍然对此行为感到困惑,建议查看相关消息队列服务的文档或与支持团队联系,以获得更具体的信息和解释。
英文:
I have a topic with two subscriptions. batchoperation is disabled at both topic level and subs level:
TopicDescription td = new TopicDescription(topicName);
td.setEnableBatchedOperations(false);
managementClient.createTopic(td);
SubscriptionDescription sd1 = new SubscriptionDescription(topicName, subOne);
sd1.setEnableBatchedOperations(false);
managementClient.createSubscription(sd1, somerule);
//2nd sub creation skipped
I verified these settings thru Service Bus Explorer.
However, I am still able to send messages to topic in batch mode using TopicClient.sendBatch(Collection<? extends IMessage> messages)
method. And I am able to read messages from each Sub using IMessageReceiver.receiveBatch(int maxMessageCount)
. How is this possible? Did I not understand the purpose of
enableBatchedOperations?
What is the purpose of enableBatchedOperations?
答案1
得分: 2
当您发送一批消息时,这是客户端端批处理。
实体级批处理旨在提高代理端吞吐量,但会增加一些延迟。请参阅此处的文档。
英文:
When you send a batch of messages, that's a client-side batching.
Entity level batching is designed to improve broker-side throughput with some added latency. See documentation here.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论