You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Stephen J <st...@mclaneco.com> on 2008/12/04 15:56:05 UTC

Interfacing with legacy Websphere MQ clients

I am working on a project that uses ActiveMQ to broker messages between
Websphere MQ queues. These MQ queues are then read by legacy MQ clients. I
have found that when ActiveMQ passes a message to a Websphere MQ it uses JMS
by default, thus causing extra information to be added to the message body.
Because the clients are legacy MQ clients they do not filter the extra
information added to the body as a JMS client would.

Therefor, I need to be able to set the targetClient property of the MQ queue
destination to 1 in order to send in default MQ format.

Can anyone tell me how to set up my destination queue so that I can set the
targetClient property?

I have looked at the Spring forums and they show how to configure the mq
queue bean, but I can't figure out how to tell ActiveMQ to use that bean as
a destination.

Thanks to anyone who has suggestions.
-- 
View this message in context: http://www.nabble.com/Interfacing-with-legacy-Websphere-MQ-clients-tp20835055p20835055.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Interfacing with legacy Websphere MQ clients

Posted by James Strachan <ja...@gmail.com>.
2008/12/4 James Strachan <ja...@gmail.com>:
> 2008/12/4 Stephen J <st...@mclaneco.com>:
>>
>> If I try with camel I receive the following error:
>>
>> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
>> resolve endpoint: mqtestserver://TEST.OUTBOUND?targetClient=1 due to: There
>> are 1 parameters that couldn't be set on the endpoint. Check the uri if the
>> parameters are spelt correctly and that they are properties of the endpoint.
>> Unknown parameters=[{targetClient=1}]
>
> Sorry my mistake - Camel tries to interpret the ?foo=bar query
> notation on an endpoint URI - you have to instead set the destination
> name on the JmsEndpoint explicitly (e.g. use the constructor).
>
> I've nearly got an example in trunk - gimme an hour...

Here you go - here's an example, which only works against trunk mind
you (or tomorrows 2.0-SNAPSHOT)...

https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/config/JmsEndpointWithCustomDestinationTest-context.xml

this example shows how you can create a JmsEndpoint and customize the
exact JMS Destination object it uses.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Interfacing with legacy Websphere MQ clients

Posted by James Strachan <ja...@gmail.com>.
2008/12/4 Stephen J <st...@mclaneco.com>:
>
> If I try with camel I receive the following error:
>
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
> resolve endpoint: mqtestserver://TEST.OUTBOUND?targetClient=1 due to: There
> are 1 parameters that couldn't be set on the endpoint. Check the uri if the
> parameters are spelt correctly and that they are properties of the endpoint.
> Unknown parameters=[{targetClient=1}]

Sorry my mistake - Camel tries to interpret the ?foo=bar query
notation on an endpoint URI - you have to instead set the destination
name on the JmsEndpoint explicitly (e.g. use the constructor).

I've nearly got an example in trunk - gimme an hour...

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Interfacing with legacy Websphere MQ clients

Posted by Stephen J <st...@mclaneco.com>.
If I try with camel I receive the following error:

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: mqtestserver://TEST.OUTBOUND?targetClient=1 due to: There
are 1 parameters that couldn't be set on the endpoint. Check the uri if the
parameters are spelt correctly and that they are properties of the endpoint.
Unknown parameters=[{targetClient=1}]


James.Strachan wrote:
> 
> 2008/12/4 Stephen J <st...@mclaneco.com>:
>>
>> I have found the solution for setting the targetClient property with JMS
>> Bridging just in case anyone runs up against this issue.
>>
>> Here's the configuration for the bridge. I can send more of the config in
>> case anyone is interested. I'm pulling from an MQ queue(TEST.INBOUND)
>> then
>> routing it through a virtual destination to a different MQ
>> queue(TEST.OUTBOUND).
>>
>> <jmsBridgeConnectors>
>>        <jmsQueueConnector
>>          outboundQueueConnectionFactory="#mqXAConFactory"
>> outboundUsername=" "
>> outboundPassword=" " >
>>          <inboundQueueBridges>
>>                <inboundQueueBridge
>>                  inboundQueueName="TEST.INBOUND"
>> localQueueName="VRT.MQTEST.WITH.AUDIT"
>> />
>>          </inboundQueueBridges>
>>           <outboundQueueBridges>
>>                <outboundQueueBridge localQueueName="OUT_TRX"
>>                         
>> outboundQueueName="queue:///TEST.OUTBOUND?targetClient=1" />
>>                 </outboundQueueBridges>
>>        </jmsQueueConnector>
>> </jmsBridgeConnectors>
>>
>> Hope this helps someone.
> 
> So if MQ supports the URI notation...
> 
> queue:///TEST.OUTBOUND?targetClient=1
> 
> you could have done this in camel via
> 
> <route>
>   <from uri="activemq:TEST.INBOUND"/>
>   <to uri="mq://TEST.OUTBOUND?targetClient=1"/>
> </route>
> 
> assuming you setup the ActiveMQComponent as "activemq" and a
> JmsComponent as "mq" in your spring.
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Interfacing-with-legacy-Websphere-MQ-clients-tp20835055p20836370.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Interfacing with legacy Websphere MQ clients

Posted by James Strachan <ja...@gmail.com>.
2008/12/4 Stephen J <st...@mclaneco.com>:
>
> I have found the solution for setting the targetClient property with JMS
> Bridging just in case anyone runs up against this issue.
>
> Here's the configuration for the bridge. I can send more of the config in
> case anyone is interested. I'm pulling from an MQ queue(TEST.INBOUND) then
> routing it through a virtual destination to a different MQ
> queue(TEST.OUTBOUND).
>
> <jmsBridgeConnectors>
>        <jmsQueueConnector
>          outboundQueueConnectionFactory="#mqXAConFactory" outboundUsername=" "
> outboundPassword=" " >
>          <inboundQueueBridges>
>                <inboundQueueBridge
>                  inboundQueueName="TEST.INBOUND" localQueueName="VRT.MQTEST.WITH.AUDIT"
> />
>          </inboundQueueBridges>
>           <outboundQueueBridges>
>                <outboundQueueBridge localQueueName="OUT_TRX"
>                          outboundQueueName="queue:///TEST.OUTBOUND?targetClient=1" />
>                 </outboundQueueBridges>
>        </jmsQueueConnector>
> </jmsBridgeConnectors>
>
> Hope this helps someone.

So if MQ supports the URI notation...

queue:///TEST.OUTBOUND?targetClient=1

you could have done this in camel via

<route>
  <from uri="activemq:TEST.INBOUND"/>
  <to uri="mq://TEST.OUTBOUND?targetClient=1"/>
</route>

assuming you setup the ActiveMQComponent as "activemq" and a
JmsComponent as "mq" in your spring.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Interfacing with legacy Websphere MQ clients

Posted by Stephen J <st...@mclaneco.com>.
I have found the solution for setting the targetClient property with JMS
Bridging just in case anyone runs up against this issue.

Here's the configuration for the bridge. I can send more of the config in
case anyone is interested. I'm pulling from an MQ queue(TEST.INBOUND) then
routing it through a virtual destination to a different MQ
queue(TEST.OUTBOUND).

<jmsBridgeConnectors>
	<jmsQueueConnector
	  outboundQueueConnectionFactory="#mqXAConFactory" outboundUsername=" "
outboundPassword=" " >
	  <inboundQueueBridges>
		<inboundQueueBridge
		  inboundQueueName="TEST.INBOUND" localQueueName="VRT.MQTEST.WITH.AUDIT"
/>
	  </inboundQueueBridges> 
	   <outboundQueueBridges>
		<outboundQueueBridge localQueueName="OUT_TRX"
			  outboundQueueName="queue:///TEST.OUTBOUND?targetClient=1" />
		 </outboundQueueBridges>
	</jmsQueueConnector>
</jmsBridgeConnectors> 

Hope this helps someone.


James.Strachan wrote:
> 
> 2008/12/4 Stephen J <st...@mclaneco.com>:
>>
>> What is the camel syntax for sending to a queue bean? I cannot find it in
>> the
>> documentation or examples.
>>
>> My queue bean is defined:
>>         <bean id="testMQdest" class="com.ibm.mq.jms.MQQueue">
>>                <constructor-arg index="0" value="AMQ.TEST.Q"/>
>>                <property name="targetClient" value="1" />
>>         </bean>
>>
>> I would figure the camel route should be something like (This doesn't
>> work):
>> <camelContext id="camel">
>>        <route>
>>          <from uri="mqin:INQ"/>
>>          <to ref="testMQdest"/>
>>        </route>
>> </camelContext>
> 
> 
> You'll need to create a JmsEndpoint for the <to> to refer to; which
> should be configured with the MQ queue object.
> 
> Its currently a little harder to totally configure a JMS endpoint with
> a custom Destination than it should be - here's an issue to track
> this...
> https://issues.apache.org/activemq/browse/CAMEL-1147
> 
> I should have an example commited in trunk shortly...
> 
> BTW the Camel forums are a better place to ask these questions going
> forwards...
> 
> http://activemq.apache.org/camel/discussion-forums.html
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Interfacing-with-legacy-Websphere-MQ-clients-tp20835055p20835962.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Interfacing with legacy Websphere MQ clients

Posted by James Strachan <ja...@gmail.com>.
2008/12/4 Stephen J <st...@mclaneco.com>:
>
> What is the camel syntax for sending to a queue bean? I cannot find it in the
> documentation or examples.
>
> My queue bean is defined:
>         <bean id="testMQdest" class="com.ibm.mq.jms.MQQueue">
>                <constructor-arg index="0" value="AMQ.TEST.Q"/>
>                <property name="targetClient" value="1" />
>         </bean>
>
> I would figure the camel route should be something like (This doesn't work):
> <camelContext id="camel">
>        <route>
>          <from uri="mqin:INQ"/>
>          <to ref="testMQdest"/>
>        </route>
> </camelContext>


You'll need to create a JmsEndpoint for the <to> to refer to; which
should be configured with the MQ queue object.

Its currently a little harder to totally configure a JMS endpoint with
a custom Destination than it should be - here's an issue to track
this...
https://issues.apache.org/activemq/browse/CAMEL-1147

I should have an example commited in trunk shortly...

BTW the Camel forums are a better place to ask these questions going forwards...

http://activemq.apache.org/camel/discussion-forums.html
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Interfacing with legacy Websphere MQ clients

Posted by Stephen J <st...@mclaneco.com>.
What is the camel syntax for sending to a queue bean? I cannot find it in the
documentation or examples.

My queue bean is defined:
         <bean id="testMQdest" class="com.ibm.mq.jms.MQQueue">
		<constructor-arg index="0" value="AMQ.TEST.Q"/>
		<property name="targetClient" value="1" />
	 </bean>

I would figure the camel route should be something like (This doesn't work):
<camelContext id="camel">	
	<route>
	  <from uri="mqin:INQ"/>
 	  <to ref="testMQdest"/>	
	</route>
</camelContext>


James.Strachan wrote:
> 
> 2008/12/4 Stephen J <st...@mclaneco.com>:
>>
>> I am working on a project that uses ActiveMQ to broker messages between
>> Websphere MQ queues. These MQ queues are then read by legacy MQ clients.
>> I
>> have found that when ActiveMQ passes a message to a Websphere MQ it uses
>> JMS
>> by default, thus causing extra information to be added to the message
>> body.
>> Because the clients are legacy MQ clients they do not filter the extra
>> information added to the body as a JMS client would.
>>
>> Therefor, I need to be able to set the targetClient property of the MQ
>> queue
>> destination to 1 in order to send in default MQ format.
>>
>> Can anyone tell me how to set up my destination queue so that I can set
>> the
>> targetClient property?
>>
>> I have looked at the Spring forums and they show how to configure the mq
>> queue bean, but I can't figure out how to tell ActiveMQ to use that bean
>> as
>> a destination.
>>
>> Thanks to anyone who has suggestions.
> 
> Try using Camel to route to MQ? Then you can reuse the same queue bean
> that the spring forums describe how to use?
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Interfacing-with-legacy-Websphere-MQ-clients-tp20835055p20835267.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Interfacing with legacy Websphere MQ clients

Posted by James Strachan <ja...@gmail.com>.
2008/12/4 Stephen J <st...@mclaneco.com>:
>
> I am working on a project that uses ActiveMQ to broker messages between
> Websphere MQ queues. These MQ queues are then read by legacy MQ clients. I
> have found that when ActiveMQ passes a message to a Websphere MQ it uses JMS
> by default, thus causing extra information to be added to the message body.
> Because the clients are legacy MQ clients they do not filter the extra
> information added to the body as a JMS client would.
>
> Therefor, I need to be able to set the targetClient property of the MQ queue
> destination to 1 in order to send in default MQ format.
>
> Can anyone tell me how to set up my destination queue so that I can set the
> targetClient property?
>
> I have looked at the Spring forums and they show how to configure the mq
> queue bean, but I can't figure out how to tell ActiveMQ to use that bean as
> a destination.
>
> Thanks to anyone who has suggestions.

Try using Camel to route to MQ? Then you can reuse the same queue bean
that the spring forums describe how to use?
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/