Confirm that a message reached the queue

徘徊边缘 提交于 2019-12-11 05:27:32

问题


I am using org.hornetq.api.core.client

how to confirm that sending a message using

producer.send("validQueue",clientMessage) 

was successful and did reached the queue ?

trying sending to invalid queue i.e

producer.send("NoneExistingQueue",clientMessage) 

did not throw hornetQException as I expected.


回答1:


With core api we allow users to do pure publish subscribe. Not having an address registered means you don't have someone connected to that particular address (i.e. not interested.. on that case messages are just ignored)

If you need that semantic, I suggest you do what we do on our JMS implementation, where we query for existent Queues.

If you know the name of the queue, I suggest you do:

QueueQuery query = session.queueQuery(queueName);

If you don't know the name of the queue and you have pure pub/sub:

BindingQuery queryBinding = session.bindingQuery(SimpleString address)

Then you may do the proper treatment for your usecase in case you have no consumers.



来源:https://stackoverflow.com/questions/19088054/confirm-that-a-message-reached-the-queue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!