William Gleeson
William Gleeson

Reputation: 91

camel jms not getting messages from IBM MQ

I have several camel microservices deployed to tomcat as individual war files. Each war file contains a unique camel route. One of the services accepts soap requests and puts a message onto a queue on IBM MQ. This works without a problem. The services which get these messages don't appear to pull the messages off the queue and forward them on. Each war file has the following as its IBM MQ configuration

   <!-- Configure IBM MQ connection factory -->
    <bean id="ibmMqConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory">
        <property name="transportType" value="1"/>
        <property name="hostName"      value="${ibm.mq.host}"/>
        <property name="port"          value="${ibm.mq.port}"/>
        <property name="channel"       value="${ibm.mq.channel}"/>
        <property name="queueManager"  value="${ibm.qm.name}"/>
    </bean>

    <bean id="ibmMqPooledConnectionFactory" class="org.apache.activemq.jms.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
        <property name="connectionFactory"                 ref="ibmMqConnectionFactory"/>
        <property name="maxConnections"                    value="8"/>
        <property name="maximumActiveSessionPerConnection" value="1"/>
        <property name="expiryTimeout"                     value="30000"/>
        <property name="idleTimeout"                       value="30000"/>
        <property name="blockIfSessionPoolIsFull"          value="false"/>
    </bean>

    <bean id="ibmMqConnectionFactorySecured" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory" ref="ibmMqPooledConnectionFactory"/>
        <property name="username"                value="${ibm.mq.username}"/>
        <property name="password"                value="${ibm.mq.password}"/>
    </bean>

    <bean id="ibmMqTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
        <property name="connectionFactory" ref="ibmMqConnectionFactorySecured" />
    </bean>

    <bean id="ibmMqJmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory"   ref="ibmMqConnectionFactorySecured"/>
        <property name="concurrentConsumers" value="4"/>
        <property name="transacted"          value="true"/>
        <property name="transactionManager"  ref="ibmMqTransactionManager" />
        <property name="cacheLevelName"      value="CACHE_NONE" />
    </bean>

    <bean id="ibmMq" class="org.apache.camel.component.jms.JmsComponent">
        <property name="configuration" ref="ibmMqJmsConfig"/>
    </bean>

An example of one of the camel routes which pulls a message of a queue looks like

<route id="cancellation-service-route" errorHandlerRef="deadLetterErrorHandler">
    <from uri="{{cancellationService.queue}}"/>
    <unmarshal ref="requestCancellationRequest"/>
    <to uri="bean:cancellationTranslator?method=transform"/>
    ...
</route>

The route starts but does not pull messages off the queue.

Upvotes: 1

Views: 1267

Answers (1)

William Gleeson
William Gleeson

Reputation: 91

I resolved the truncation issue by doing <convertBodyTo type="String" /> before sending the message to the queue. I suspect it is because the message is an UTF-8 ecoded xml message.

Upvotes: 1

Related Questions