ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Spring Property

Post new topic  Reply to topic
 Spring Property « View previous topic :: View next topic » 
Author Message
JavaRat
PostPosted: Thu Sep 25, 2008 4:20 am    Post subject: Spring Property Reply with quote

Newbie

Joined: 23 Jun 2008
Posts: 8

Hello,

We have setup a Apache Camel Spring JMS application which can put message onto an IBM MQ websphere queue successfully using the following standard setup.

Code:
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType">
<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ"/>
</property>
<property name="queueManager" value="MW01"/>
<property name="hostName" value="xxx.xxx.xxx.xxx"/>     
<property name="port" value="1414"/>
</bean>
</property>
</bean>

<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
      <route>
        <from uri="activemq:my.queue.in"/>
         <to uri="ibmmq:queue:my.queue.out"/>
      </route>
</camelContext>

<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://127.0.0.1:61616" />
</bean>
</property>
</bean>


We now want to set a few properties on our messages such as JMSReplyTo, JMS_IBM_Format, JMS_IBM_MsgType.
Is it possible to set these in spring? In what ways can we solve this?

Thanks in advance!

/JavaRat
Back to top
View user's profile Send private message
atheek
PostPosted: Thu Sep 25, 2008 5:34 am    Post subject: Reply with quote

Partisan

Joined: 01 Jun 2006
Posts: 327
Location: Sydney

Hi Javarat,

I have seen your post here:
http://www.nabble.com/Bridging-the-ActiveMQ-with-IBM-Websphere-using-Camel-td19623329s22882.html

Your problem appears to because you are getting the rfh header in the message. The MQ Queue destination object has a property TARGCLIENT which by default takes a value JMS. And in case you will get the RFHeader wrapped around the message..To remove this you need to set targclient to MQ. I have no clue on how you set this on spring..just try to figure out to set this..it may solve your issue
Back to top
View user's profile Send private message
JLRowe
PostPosted: Thu Sep 25, 2008 5:47 am    Post subject: Re: Spring Property Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

Look at the JMS template mechanism in Spring and use of the class org.springframework.jms.core.JmsTemplate, you can set a message converter class that can convert between your domain object and a JMSMessage it can also perform customisation of the message - i.e. setting provider specific properties.

This is all documented in the spring documentation.


JavaRat wrote:
Hello,

We have setup a Apache Camel Spring JMS application which can put message onto an IBM MQ websphere queue successfully using the following standard setup.

Code:
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType">
<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ"/>
</property>
<property name="queueManager" value="MW01"/>
<property name="hostName" value="xxx.xxx.xxx.xxx"/>     
<property name="port" value="1414"/>
</bean>
</property>
</bean>

<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
      <route>
        <from uri="activemq:my.queue.in"/>
         <to uri="ibmmq:queue:my.queue.out"/>
      </route>
</camelContext>

<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://127.0.0.1:61616" />
</bean>
</property>
</bean>


We now want to set a few properties on our messages such as JMSReplyTo, JMS_IBM_Format, JMS_IBM_MsgType.
Is it possible to set these in spring? In what ways can we solve this?

Thanks in advance!

/JavaRat
Back to top
View user's profile Send private message Send e-mail
JavaRat
PostPosted: Thu Sep 25, 2008 6:06 am    Post subject: Reply with quote

Newbie

Joined: 23 Jun 2008
Posts: 8

Thank you kindly for your suggestions atheek and JLRowe!

If we find a solution to this I will surely post it here.
targetclient=1 has previously been set through use of the URI but unfortunately we can not do this with ApacheCamel since it does not accept/recognize it as a valid parameter. This might be the key here if it is possible to set it in some other way.

Next step will be to dig deeper into the Spring configuration which we so far have failed to find a solution for. There may be a way here to set it?!

/JavaRat
Back to top
View user's profile Send private message
atheek
PostPosted: Thu Sep 25, 2008 5:30 pm    Post subject: Reply with quote

Partisan

Joined: 01 Jun 2006
Posts: 327
Location: Sydney

If you manage to set TARGCLIENT to 1, you may end up in removing the RF Headers, but still you may not be able to set the MQMD headers. Your current configuration sets these in RF headers and not in MQMD, so when you remove rf headers you may remove these properties also..you may require to find ways for setting the mqmd headers
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Sep 25, 2008 6:19 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

javarat wrote:
We now want to set a few properties on our messages such as JMSReplyTo, JMS_IBM_Format, JMS_IBM_MsgType.
Is it possible to set these in spring? In what ways can we solve this?

Now this has me somewhat stumped. Color me stupid but I thought that those properties were mostly being set by JMS for you. You need do nothing.
Unless javarat wants to set something different from the standard? And then why use JMS ???
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Mon Sep 29, 2008 1:17 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

I think he wants the code to be non-JMS provider specific, and get all the contact admin JMS provider specific stuff into the spring configuration.

And he may need to set MQ JMS properties because he wants to interact with a non-jms service on the other end of the queue, but still wants to code to the JMS standard.

I recently had a similar situation where I was using WMQ in production, but using the in-memory activeMQ JMS provider for automated unit testing. All the JMS configuration was abstracted away into the spring configuration.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Mon Sep 29, 2008 10:24 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

JLRowe wrote:
I think he wants the code to be non-JMS provider specific, and get all the contact admin JMS provider specific stuff into the spring configuration.

And he may need to set MQ JMS properties because he wants to interact with a non-jms service on the other end of the queue, but still wants to code to the JMS standard.

I recently had a similar situation where I was using WMQ in production, but using the in-memory activeMQ JMS provider for automated unit testing. All the JMS configuration was abstracted away into the spring configuration.


My point was that you should not have to set the fields he described. JMS will set them behind the scenes for you. The standard works well. Unless he is trying to do something weird with the content of those fields, some combination of values that you would not expect, I see no reason for trying to meddle with this.
To be more specific:
  • JMSReplyTo this should be set on the JMS message, I am sure Spring has a way of doing that, so use the standard.

  • JMS_IBM_Format: DO NOT SET this field. It gets set depending on the message type you chose: BytesMessage, TextMessage etc...

  • JMS_IBM_MsgType: DO NOT SET this field. It gets set behind the scenes. The default is a datagram. However when a JMSReplyTo Destination has been defined it gets changed to request. You have nothing to do.


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Tue Sep 30, 2008 5:49 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

sorry fjb_saper I got the wrong end of the stick, yes he should not need to mess with those fields
Back to top
View user's profile Send private message Send e-mail
JavaRat
PostPosted: Sun Oct 05, 2008 10:57 pm    Post subject: Reply with quote

Newbie

Joined: 23 Jun 2008
Posts: 8

I am completely dead wrong here in the first place. Even though I completely missunderstood pretty much everything you still managed too grasp my ignorance and came up with a solution too my problem!
Nice work guys!

So the next step here is actually too let the IBM MQ Queue know that the message I intend to put is a JMS-message?!

This is done with the call setTargetClient=1 (as atheek points out)

After some research I found that targetClient may be set using the class com.ibm.mq.jms.MQDestination and com.ibm.mq.jms.MQQueue. Not quite sure which one to use here to be frank.
In spring this will look something like:

<bean id="myBeanName" class=" com.ibm.mq.jms.MQDestination">
<property name="targetClient" value="1"/>
</bean>

How to make this work in spring is not a question for this forum. Still it might be useful too others to learn what I have found so far so I will leave some newbie springattempts here.

There is one mqseries-post close to what we are trying to achieve which might be of help:

http://www.mqseries.net/phpBB2/viewtopic.php?p=226204#226204

(close to the solution?)

I have not got this working yet (as there is no defaultDestination or other destination to use in the org.apache.camel.component.jms.JmsComponent case see http://activemq.apache.org/camel/maven/camel-jms/apidocs/org/apache/camel/component/jms/class-use/JmsComponent.html ) however the solution should look something like this:




Code:
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType">
<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ"/>
</property>
<property name="queueManager" value="QMgr"/>
<property name="hostName" value="xxx.xxx.xxx.xxx"/>   
<property name="port" value="1414"/>
</bean>
</property>
<property name="queue" ref="ibmqueueprop" />
</bean>

<bean id="ibmqueueprop" class=" com.ibm.mq.jms.MQDestination">
<property name="targetClient" value="1"/>   
</bean>


What I think you are trying to tell me in the above posts is to skip out? the bean <bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent> ? in favor of
org.springframework.jms.core.JmsTemplate?

I will update this post if I find the answear. Thanks again !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Spring Property
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.