hornetq guarantee that the message reached the queue
I am using org.hornetq.api.core.client how can I guarantee the message that I am sending actually reached the queue (not the client, just the queue) ?
please note that the queue is a valid queue .
It really depends on how you are sending.
First question of yours was about First of all, on JMS you have to way to send to an invalid queue since the producer will validate the queue's existence. On HornetQ core api you send to an address (not to a queue), and you may have an unbound queue. So you have to query if the address has queues or not.
Now, for confirmation the message was received:
- Scenario I, persistent messages, non transactionally
Every message is sent blocked. The client will unblock as soon as the server acknowledged receiving the message. This is done automatically.. you don't have to do anything.
- Scenario II, non persistent messages, non transactionally
There are no confirmations by default. The message is sent asynchronously. We assume the message is transient and it's not a big deal if you lost it. you can change that by setting block-on-non-persistent-send on the ServerLocator.
- Scenario III, transactionally (either persistent or not).
As soon as you call commit the message is on the queues.
- Scenario IV, Confirmation send
You set a callback and you get a method call as soon as the server acked it on the queues. Look on the manual for confirmation callback. There's also the same feature on JMS2.