MaxConcurrentListeners 和来自 MSMQ 的远程事务读取
难道 DistributedTxMessageListenerContainer 上的 MaxConcurrentListereners 没有多大用处吗?我的印象是一次只有一个线程可以处理队列中的消息。也许这是合乎逻辑的,因为只有在事务成功后消息才会从队列中删除。还是我这里错了?
Could it be that MaxConcurrentListereners on a DistributedTxMessageListenerContainer isn't much of use? I have the impression that only one thread at a time can handle a message from the queue. Maybe it's logical since the message will only be removed from the queue once the transaction is successfull. Or am I wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,只有一个线程可以从队列接收特定消息。
不过,多个线程可以同时从队列接收消息。
当从队列中以事务方式接收消息时,它对所有其他线程都变得不可见,直到事务中止提交为止。
如果中止,则消息将重新出现在队列中(再次可见);如果提交,则该消息将从队列中物理删除。
干杯
约翰·布瑞克威尔
Yes, only one thread can receive a particular message from a queue.
Multiple threads can be receiving messages from a queue at any one time, though.
When a message is transactionally received from a queue, it becomes invisible to all other threads until the transaction aborts of commits.
If it aborts then the message reappears in the queue (made visible again); if it commits then the message is physically deleted from the queue.
Cheers
John Breakwell