activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dejan Bosanac <de...@nighttale.net>
Subject Re: How to reattempt individual message
Date Fri, 29 Jul 2011 08:18:16 GMT
Hi,

you should use JMS transactions and rollback the transaction to trigger
message redelivery.

Regards
-- 
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jul 28, 2011 at 7:19 PM, srikanth reddy <srikanth03565@gmail.com>wrote:

> Hi,
>
> I am implementing ActiveMQ Middleware using Queue based JMS .
> I am facing individual message  Rollback issue from last few days
>
> There are multiple message posted to my activemq and one i start activemq
> my
> session starts reading messages.I am using individual message
> acknowledgement.
> i.e  qConnection.createQueueSession(false,
> ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE);
>
> Once i receive message in my message listener i am sending message to child
> thread and processing message there and processing is completed i am
> sending
> acknowledgement.
>
> But problem here is if any exception comes in middle of my message i want
> to
> reattempt for that specific message.
>
> I have tryed session.recover here but its recovering all messages on that
> session which is wrong
>
> Please look into my message consumer and listener
>           Consumer class outline
> public  QueueSession session = null;
>
> public QueueConnection qConnection = null;
>        ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(url);
>        qConnection = connectionFactory.createQueueConnection();
>        session = qConnection.createQueueSession(false,
> ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE);
>        QueueReceiver _receiver =
>                    session.createReceiver(getTransactionQueue(session));
>        _receiver.setMessageListener(getMessageListener());
>
>       //my message listener
>        public void onMessage(Message message)  {
>                //starting chaild thread etc
>                if(doprocess()){
>                        session.acknowledge();
>                } else {
>  //want to roll back/reattempt specific message
>                }
>      }
>
> Please help me to resolve this issue
>
> Thanks & Regards
> Srikanth Reddy
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message