Custom Exceptions Routing to DLQ in ActiveMQ Using Spring JMS -


i using broker activemq 5.5.1 , spring jms messaging. have requirement below

a) want push messages dlq when respective exception occurs. per understanding, exceptions thrown message listeners moved dlq after specified retry parameters. activemq provide facility , how ?

b) have control retry mechanism based on class level meaning no-retry custom exceptions. example, if there instance of myexception class thrown, should not retry messages such should not go dlq. please advise

-----edit-----------

i tried restrict retry attempts when jmsredelivered true. message though exception thrown once retry not adding dlq. here test code. using activemq 5.5.1

 public void onmessage(message message) {     try {         if (message != null)             if (message instanceof textmessage) {                 string messagecontent = ((textmessage) message).                 if (message.getbooleanproperty("jmsredelivered")) {                     throw new customexception1();                 } else {                     throw new customjmsexception("retry logic");                 }             }         }     } catch (jmsexception jmsex) {      } catch (customexception1 e) {         system.out.println("exception caught");     } catch (customjmsexception e) {         throw new customjmsexception("exception thrown");     }   spring configuration:  <bean id="redeliverypolicy1" class="org.apache.activemq.redeliverypolicy">     <property name="initialredeliverydelay" value="1000" />     <property name="redeliverydelay" value="1000" />      <property name="maximumredeliveries" value="5" />     <property name="useexponentialbackoff" value="false" />     <property name="backoffmultiplier" value="1" />  </bean> 

all need catch (and ignore or log) exceptions want ignore , re-throw want route dlq.

or, use spring-retry instead of activemq's mechanism; has policies determine exceptions should retried , recoverycallback allows decide exceptions absorb or re-throw.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -