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 » application property is lost when using jms, websphere MQ

Post new topic  Reply to topic
 application property is lost when using jms, websphere MQ « View previous topic :: View next topic » 
Author Message
gavon stone
PostPosted: Wed Mar 09, 2005 12:18 pm    Post subject: application property is lost when using jms, websphere MQ Reply with quote

Novice

Joined: 09 Mar 2005
Posts: 16

posted March 08, 2005 11:01 AM
--------------------------------------------------------------------------------
I am trying to set an application specific property on a message from a java program using JMS and websphere MQ 5.3 but I keep on getting errors when I try to open the message on the receiving side.

My code to set the property is :

message.setIntProperty("OrderNumber",num);

In my other application when I try to read the the property :

int prop = msg.getIntProperty("OrderNumber");


The error that I get is :

java.lang.NumberFormatException

at com.ibm.jms.JMSMessage.toInt(JMSMessage.java:6132)
at com.ibm.jms.JMSMessage.getIntProperty(JMSMessage.java:4012)
at com.pmt.msgs.SortMsg.MsgSorter.main(MsgSorter.java:82)
Exception in thread "main"


Also when I print out all message properties, my property "OrderNumber" does not show up in the receiving applications list, so the property is there when I send the message but somewhere it gets lost.


Thanks for your help.
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Mar 09, 2005 12:36 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I just took the mqjmssel.java and mqjmsusr.java from:

http://www.developer.ibm.com/tech/sampmq.html

and tried what I think you are doing. It worked for me. I added two lines to the mqjmssel.java program to get the integer:
Code:

int myInt = inMessage.getIntProperty("IntTag2");
System.out.println("myInt = " + myInt);

I added them right before the catch in the onMessage.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
fjb_saper
PostPosted: Wed Mar 09, 2005 12:50 pm    Post subject: Reply with quote

Grand High Poobah

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

Check out your manuals. Some properties are put into the RFH header and will not work if the RFH header is being stripped somewhere en route...
Enjoy
Back to top
View user's profile Send private message Send e-mail
gavon stone
PostPosted: Wed Mar 09, 2005 12:53 pm    Post subject: Reply with quote

Novice

Joined: 09 Mar 2005
Posts: 16

how do you ensure that the mqrfh2 header is kept all the way since I did read that the property is in that header.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 09, 2005 1:00 pm    Post subject: Reply with quote

Grand High Poobah

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

Responsability of the different brokers the message might get routed through.

Enjoy
Back to top
View user's profile Send private message Send e-mail
gavon stone
PostPosted: Wed Mar 09, 2005 1:05 pm    Post subject: Reply with quote

Novice

Joined: 09 Mar 2005
Posts: 16

I have only one queue on a windows machine and both applications (sender and receiver) are local, do you know what settings on that queue or queue mananger I must change to keep the mqrfh2 header.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 09, 2005 1:13 pm    Post subject: Reply with quote

Grand High Poobah

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

Check your JNDI setting for the queue. It must specify target client type JMS and NOT MQ. If you have MQ the RFH header will not be on the message.

Check out the message in the MQ explorer. You should see the RFH header.

Enjoy
Back to top
View user's profile Send private message Send e-mail
gavon stone
PostPosted: Wed Mar 09, 2005 1:16 pm    Post subject: Reply with quote

Novice

Joined: 09 Mar 2005
Posts: 16

I am not using jndi settings for my queue, I did see that the jms administration tool can be used in the manual, but I am not using that also, could I set the property to keep all mqrfh headers from within my program without jndi or on the queue manager itself.
Back to top
View user's profile Send private message
gavon stone
PostPosted: Wed Mar 09, 2005 1:36 pm    Post subject: Reply with quote

Novice

Joined: 09 Mar 2005
Posts: 16

I just got it to work, I switched:

queueLocal.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ );

to

queueLocal.setTargetClient(JMSC.MQJMS_CLIENT_JMS_COMPLIANT);

thanks fjb_spaer
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Mar 09, 2005 1:38 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

You can set the target client programmatically. Try something like:
Code:

import com.ibm.mq.jms.*;
 ...
Queue srvQueue;
 ...
srvQueue = (Queue)ctx.lookup("srvQueueName"); ((MQQueue)srvQueue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);


The other value for this parameter would be JMSC.MQJMS_CLIENT_JMS_COMPLIANT.

I got this from:

http://www.developer.ibm.com/tech/faq/individual?oid=2:25093
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
bower5932
PostPosted: Wed Mar 09, 2005 1:48 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I see that you got it to work while I was typing in my append. I also just noticed that my append has the code example set for non-JMS and then references the JMS version in my text.

One down side to putting this code into your program is that it makes it specific to WMQ's version of JMS.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » application property is lost when using jms, websphere MQ
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.