Rollback is not working with WMQ while throwing Exception with Spring and JBOSS eap-6.1 -
i using jboss eap-6.1 ,wmq spring.when rolling messages , not going backout , not staying inqueue.but working activemq.below configuration files,please me if doing wrong. jboss/standalone.xml configuration <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> <resource-adapters> <resource-adapter id="wmq.jmsra.rar"> <archive> wmq.jmsra.rar </archive> <transaction-support>xatransaction</transaction-support> <connection-definitions> <connection-definition class-name="com.ibm.mq.connector.outbound.managedconnectionfactoryimpl" jndi-name="java:jboss/mq.connectionfactory.name" pool-name="mq.connectionfactory.name"> <config-property name="port"> ${queue.port} </config-property> <config-property name="hostname"> ${queue.host} </config-property> <config-property name="username"> ${queue.server.username} </config-property> <config-property name="channel"> ${queue.server.channel} </config-property> <config-property name="transporttype"> ${queue.transporttype} </config-property> <config-property name="queuemanager"> ${queue.manager} </config-property> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="com.ibm.mq.connector.outbound.mqqueueproxy" jndi-name="java:jboss/mq.queue.name.in" pool-name="mq.queue.name.in"> <config-property name="basequeuename"> ${queue.name.in} </config-property> </admin-object> <admin-object class-name="com.ibm.mq.connector.outbound.mqqueueproxy" jndi-name="java:jboss/mq.queue.name.backout" pool-name="mq.queue.name.backout"> <config-property name="basequeuename"> ${queue.name.backout} </config-property> </admin-object> </admin-objects> </resource-adapter> </resource-adapters> spring configuration file jms.xml <jee:jndi-lookup id="avtconnectionfactory" jndi-name="java:jboss/mq.connectionfactory.name" /> <jee:jndi-lookup id="avtmessagequeue" jndi-name="java:jboss/mq.queue.name.in" /> <jee:jndi-lookup id="driveridrequestqueue" jndi-name="java:jboss/mq.queue.name.out" /> <jee:jndi-lookup id="backoutqueue" jndi-name="java:jboss/mq.queue.name.backout" /> <bean id="vehiclepositionreplylistener" class="org.springframework.jms.listener.defaultmessagelistenercontainer"> <property name="connectionfactory" ref="avtconnectionfactory" /> <property name="destination" ref="avtmessagequeue" /> <property name="messagelistener" ref="vehiclereplymdp" /> <property name="sessiontransacted" value="true" /> </bean> listener file @named("vehiclereplymdp") @transactionattribute(transactionattributetype.not_supported) public class vcglistenermdp implements vcglistenermdpservice { @override public void onmessage(message message, session session) throws jmsexception { log.debug("----------------- queuein listener--------------"); try { if (message instanceof textmessage) { boolean val=processincomingmessage(message, session); if(!val){ throw new jmsexception("jmsexception"); } } } catch (jmsexception e) { log.error("exception processing mesage: {}", e.tostring()); throw new runtimeexception(e); } catch (namingexception e) { e.printstacktrace(); } } public boolean processincomingmessage(message message, session session) throws jmsexception, namingexception { initialcontext ctx = new initialcontext(); namingenumeration<nameclasspair> list = ctx.list(""); boolean isactivemqflg = false; while (list.hasmore()) { nameclasspair next = list.next(); if (next.getname().contains(active_mq_jndi_ref)) { isactivemqflg = true; break; } } try { // checking database connectivity jurisdictionservice.getjurisdictioncount(); } catch (exception ex) { if (isactivemqflg) { session.rollback(); } else { ex.printstacktrace(); } return false; }
when using session.rollback working activemq,for wmq when throwing exception not rolling , event trigger backout threshold not working.the threshold 3 times,it triggers first time.
Comments
Post a Comment