0

Quoting from EIP patterns book from Hohpe G. and Woolf B. :

Note that in JMS, an Event-Driven Consumer that is also a Transactional Client will not work as expected. Normally a transaction is rolled back when the code in the transaction throws an exception, but the MessageListener.onMessage signiture does not provide for an exception being thrown (such as JMSException), and a runtime exception is considered programmer error. If a runtime exception occurs, the JMS provider responds by delivering the next message, so the message that caused the exception is lost.To successfully achieve transaction, event-driven behavior, use a message-driven EJB.

I understand that, but what if I'm using Apache NMS (ActiveMQ) from a .Net Client ? I don't have MDB so how should I adress this issue ?

LMeyer
  • 2,570
  • 1
  • 24
  • 35

1 Answers1

0

The ActiveMQ NMS client async consumer functions in essentially the same way as the Java version. You should handle exceptions in you callback since they are treated as programmer error in NMS as well and the next message is delivered when in a transaction.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • I'm not sure to understand what you're saying. Can you provide an example ? – LMeyer Dec 04 '12 at 07:59
  • For a more specific answer you need to ask a more specific question. What are you trying to accomplish and what is not currently working for you. – Tim Bish Dec 04 '12 at 22:37
  • I'd like to have a reliable messaging infrastructure by implementing transactions, especially regarding Request/Reply. Nothing set in stone right now, just considering the implementation. For example in the reply part, I could just use a try/catch with Begin/Commit right ? – LMeyer Dec 04 '12 at 23:14
  • There is no begin, in your handler you can either commit, or rollback or you can do this at some higher level, the Session is the arbiter of TX commit / rollback. Its up to you to decide if this is per message or bound to some batch of messages being received. – Tim Bish Dec 05 '12 at 16:10