activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlpedrosa <jlpedr...@gmail.com>
Subject Rollback/NACK a single message
Date Thu, 14 Nov 2013 14:42:52 GMT
Hi All,We are coding an application to process events in a queue. We are
using NMS - ActiveMQ 1.6.
In my mental model the best transactionality comes with:
IndividualAcknowledge.
If the proccess goes OK, the message is acknoledge, up to there no problem.
But message has no rollback/nack method. So I don't really know how to
perform that patter. Should I open a session per message? (As I want
multiple threads running at the same time, sequential is not an option).
somthing like:
/IMessage m = messageListener.GetMessage();
ThreadPool.QueueUserWorkItem(new WaitCallback(this.DispatchMessage), m);
/
/public void DispatchMessage(Object messageToDispatch)
        {
            IMessage m = messageToDispatch as IMessage;
            
            try
            {
                //Convert to Event.
                Event ev = UnMarshallMessage(m); --> not relevant code
                //Create an instance of the executor
                EventProccessor executor =
Activator.CreateInstance(ExecutorType) as EventProccessor ;
                //Invoke the executor
                executor.ProcessEvent(ev);
                //commit the message                
                m.Acknowledge();
            }
            catch (Exception ex)
            {   
                log.Error("Error processing the message", ex); 
                m.Rollback() --> does not exist
            }  
}/
Thanks in advance for any suggestion,
Jose Luis




--
View this message in context: http://activemq.2283324.n4.nabble.com/Rollback-NACK-a-single-message-tp4674444.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message