简体   繁体   English

如何查询JMS队列的元素而不删除它们

[英]how to consult the elements of a JMS queue without deleting them

Good morning, I have a queue in a wso2 message broker. 早上好,我在wso2消息代理中排队。 I would like to know if in java there is a way to be able to consult the elements of a queue without deleting them. 我想知道在Java中是否有一种方法可以查询队列中的元素而不删除它们。 I tried to use the QueueBrowser but the application goes me wrong (my question --> JMS: Server closed connection and reconnection not permitted ). 我尝试使用QueueBrowser,但是应用程序使我出错(我的问题-> JMS:服务器关闭连接和重新连接不允许 )。 The connection is correct because if I create a consumer it works for me I wanted to know if you knew another way. 这种连接是正确的,因为如果我创建一个使用者,那么它对我有用,我想知道您是否知道另一种方式。

Thank you. 谢谢。

It should work and looking at your code in the linked question it seems correct. 它应该可以工作,并在链接的问题中查看您的代码,这似乎是正确的。 A very dirty approach is to actually read the messages within a transaction and rollback when done. 一种非常脏的方法是在事务中实际读取消息并完成后回滚。 Transactions are not always supported, though, and regardless reading and rolling back is expensive, so I would only do that as a last resort. 但是,并非总是支持事务,并且无论读取和回滚是多么昂贵,因此,我只会在万不得已时才这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM