Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save iamsenorespana/4dcbea8a0c82307150bc50406c00f3c6 to your computer and use it in GitHub Desktop.

Select an option

Save iamsenorespana/4dcbea8a0c82307150bc50406c00f3c6 to your computer and use it in GitHub Desktop.
Camel route example to implement a brifge between A-MQ and IBM MQ...
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2005-2015 Red Hat, Inc.
Red Hat licenses this file to you under the Apache License, version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://amq?create=false" />
<property name="userName" value="admin" />
<property name="password" value="admin" />
</bean>
<bean id="amqConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="amqConnectionFactory" />
<property name="concurrentConsumers" value="10" />
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="amqConfig" />
</bean>
<bean id="wmqConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="wmqConnectionFactory" />
<property name="concurrentConsumers" value="10" />
</bean>
<bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="wmqConfig" />
</bean>
<bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="CHANGE ME" />
<property name="port" value="CHANGE ME" />
<property name="queueManager" value="CHANGE ME" />
<property name="channel" value="CHANGE ME" />
<property name="targetClientMatching" value="true" />
</bean>
<bean id="WMQ-Queue" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="QM CHANGE ME" />
<constructor-arg value="QName CHANGEME" />
<property name="targetClient" value="1" />
</bean>
<bean id="AMQ-Queue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="QName CHANGEME" />
</bean>
<camelContext id="uhg-bridge" xmlns="http://camel.apache.org/schema/spring">
<route id="wmq-to-amq-bridge">
<from uri="wmq:queue:CHANGEME?disableReplyTo=true" />
<to uri="activemq:queue:CHANGEME?disableReplyTo=true" />
</route>
<route id="wmq-to-amq-bridge-echo">
<from uri="wmq:queue:CHANGEME?disableReplyTo=true" />
<setHeader headerName="JMSReplyTo" >
<simple>${ref:AMQ-Queue}</simple>
</setHeader>
<log message="${header.JMSReplyTo}"/>
<to uri="activemq:queue:CHANGEME?disableReplyTo=true" />
</route>
<!-- route id="amq-to-log">
<from uri="activemq:queue:CHANGEME?disableReplyTo=true" />
<log message="${body}"/>
</route -->
<route id="amq-to-wmq-bridge">
<from uri="activemq:queue:CHANGEME?disableReplyTo=true" />
<setHeader headerName="JMS_IBM_MsgType">
<constant>8</constant>
</setHeader>
<setHeader headerName="JMS_IBM_MsgType">
<simple>${headerAs("JMS_IBM_MsgType", java.lang.Integer)}</simple>
</setHeader>
<to uri="wmq:queue:CHANGEME?destination=#WMQ-Queue&amp;disableReplyTo=true" />
</route>
</camelContext>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment