camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmhatre <darpan27...@gmail.com>
Subject Help with tracking JmsMessageId or creating jmsmessage to passing as exchange to jms endpoint
Date Sat, 16 Jun 2012 00:14:21 GMT
Hi Folks,
    Please help. Below is my configuration and routes..

route
=================================================
 	<route>
	<from uri="bean:readyOutgoingMessageSql?method=getRawMessage"/>
	<to uri="bean:readyOutgoingMessageSql?method=getMessageFormat"/>
	<process ref="readyOutgoingMessageProcessor"/>
	<choice>
	<when>
		<simple>${in.header.mqDefId} == '1'</simple>
                	<to uri="dtccPol-JMS:queue:LQ_SPO"/>
                	<to uri="bean:printer?method=printFileNames" />
	</when>					
	<when>
		<simple>${in.header.mqDefId} == '2'</simple>
                	<to uri="dtccDox-JMS:queue:LQ_DOX"/>
                	<to uri="bean:printer?method=printFileNames" />
	</when>
	<otherwise>
                	<to uri="bean:printer?method=printFileNames" />
            	</otherwise>
	</choice>	
	</route> 

Processor 
=======================================
public class OutgoingMessageProcessor  implements Processor {
	
	private static Logger log =
Logger.getLogger(OutgoingMessageProcessor.class);

	@Override
	public void process(Exchange ex) throws Exception {
		
		if(ex.getIn().getBody()!=null){
			Map<String, Object> m = ex.getProperties();
			WrappedMessageModel wm = (WrappedMessageModel)ex.getIn().getBody();
			
			if(wm.getMessage()!=null && wm.getMessageFormat()!=null){

				ex.setPattern(ExchangePattern.InOnly);			
				ex.getIn().setHeader("mqDefId", wm.getMessageFormat().getMqDefId());	
				
				ex.getIn().setBody(wm.getMessage().getMessage());
			}
		}			
	}
}

where get message return byte[]

JMS Configuration
===========================================

<bean id="dtccDoxConnectionFactory"
class="com.ibm.mq.jms.MQXAQueueConnectionFactory">
		<property name="hostName" value="127.0.0.1" />
		<property name="port" value="1414" />
		<property name="queueManager" value="booradley" />
		<property name="channel" value="booradley" />
		<property name="transportType" value="1" />
	</bean>
	<bean id="atomikosDtccDoxConnectionFactory"
class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init"
destroy-method="close"> 
  		<property name="xaConnectionFactory"><ref
bean="dtccDoxConnectionFactory"/></property>
  		<property name="uniqueResourceName" value="DTCC_DOX_JMS"/>
  		<property name="poolSize" value="50"/>
	</bean>
	<bean id="dtccDoxJmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
		<property name="connectionFactory" ref="atomikosDtccDoxConnectionFactory"
/>
		<property name="transactionManager" ref="JtaTransactionManager"/>
	</bean>
	<bean id="dtccDox-JMS" class="org.apache.camel.component.jms.JmsComponent">
		<property name="configuration" ref="dtccDoxJmsConfig" />
	</bean>

--
View this message in context: http://camel.465427.n5.nabble.com/Help-with-tracking-JmsMessageId-or-creating-jmsmessage-to-passing-as-exchange-to-jms-endpoint-tp5714570.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message