2

I'm trying use apache nms stomp for send/receive messages. I can not use Transnational ack mode, because of using hornetq. My consumer scenario:

  1. Receive a message
  2. Process the message
  3. ACK it if process succeed (with message.Acknowledge())
  4. NACK it if process failed (????)

All i want is NACK the message if process is failed; so how can i NACK a message in apache nms?

Arya
  • 2,809
  • 5
  • 34
  • 56

1 Answers1

1

I don't know of any reason why you can't use transactions with HornetQ. The only way currently to have the client send a NACK is to use a transaction and Rollback the Transaction on error. Once you reach the configured Max allowed redeliveries the client will NACK the Message.

In most implementations if your client doesn't ACK a Message and then disconnects the message would be redelivered to another client. In the case of ActiveMQ you can configure a maximum number of times that the broker would attempt this before it moved the message into a Dead Letter Queue.

As it stands right now the NMS.Stomp implementation doesn't NACK a message when an exception is thrown from the asynchronous message callback however this could be a sensible enhancement, the project does accept contributions so dive in.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • HornetQ user manual: Message acknowledgements are not transactional. The ACK frame can not be part of a transaction (it will be ignored if its transaction header is set). – Arya Apr 20 '13 at 10:54
  • Then Use ActiveMQ or Apollo which is spec compliant. – Tim Bish Apr 20 '13 at 13:28
  • If i don't Ack a message, will it remain in the queue? (the message won't be lost?) – Arya Apr 20 '13 at 16:02