You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2015/09/03 16:29:02 UTC

Re: IBM MQ and "replyTo" useage - not working

Hi

Do you have activemq-camel on the classpath, if so it has type
converters for String -> queue instance and hence creates an
ActiveMQQueue.

You likely need to create a IBM queue instance as a <bean> etc and
refer to that in the <setHeader>

Something on the line of

<bean id="myReplyQueue" class="com.ibm....MQQueue">
  <constructor ...>
</bean>


And then

<serHeader ...>
   <simple>${ref:myReplyQueue}</simple>
...

On Mon, Aug 24, 2015 at 1:03 AM, clinton <cl...@ionep.com> wrote:
> I have a Spring XML DSL route that runs as a JMS consumer in request/reply
> mode. This route is intended to write a JMS message as a JMS Producer that
> will send a request message to a downstream process, with a ReplyTo queue
> designated.  The reply will however be processed by yet another route that
> consumes from the static reply-to queue in use with that downstream process.
>
> My problem is that I can't get the IBM MQ message to accept and pass a
> replyToQueue name.
>
> I've setup MQ as follows: ***********
> <bean id="springMQConnectionFactory"
> class="com.ibm.mq.jms.MQQueueConnectionFactory">
>         <property name="transportType" value="1" />
>         <property name="queueManager" value="${qmgr.name}" />
>         <property name="hostName" value="${qmgr.hostname}" />
>         <property name="port" value="${qmgr.port}" />
>         <property name="channel" value="${qmgr.channel}" />
> </bean>
> <bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
>         <property name="connectionFactory" ref="springMQConnectionFactory" />
> </bean>
>
>
> Then, the code looks like this **************
> <setHeader headerName="CamelJMSDestinationName">
>         <simple>queue:///MY.REQUEST.Q?targetClient=1</simple>
> </setHeader>
>  <setHeader headerName="JMS_IBM_MsgType">
>         <simple resultType="java.lang.Integer">1</simple>
> </setHeader>
> ...
> <to uri="ibmmq:queue:dummy?replyTo=MY.REPLY.Q&amp;disableReplyTo=true" />
>
> In this mode, the message send fails with IBM MQ return code 2027, meaning
> I've tried to send a "request/reply" type message, but without specifying a
> replyQ name., which I obviously did.
>  (I also tried putting the "queue:///" prefix on the replyq name)
>
> I tried the following also.
>
> <setHeader headerName="JMSReplyTo">
>         <constant>MQ.REPLY.Q</constant>
> </setHeader>
>  But this didn't help.
>
> One interesting thing. When I did not set the JMS_IBM_MsgType at all, the
> message was put successfully with the replyTo set in the "to" URI string,
> but no replyq was sent with the message. (The message was defaulting to the
> "datagram" type.) But when setting the JMSReplyTo header, again the message
> was sent with no replyq in it, but after sending the message, but before
> returning control to the route, I got an exception thrown as follows.
>
> Exception: java.lang.ClassCastException:
> org.apache.activemq.command.ActiveMQQueue cannot be cast to
> com.ibm.mq.jms.MQQueue
>
> This makes me think there is some internal conflict between running as a
> request/reply JMS consumer on activeMQ, and then attempting to be a Producer
> using IBM MQ.
>
> I'm running Camel 2.15.1, MQ 8.0, and ActiveMQ 5.11.0 on Linux and JbossEAP
> 6
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/IBM-MQ-and-replyTo-useage-not-working-tp5770930.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2