问题
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