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 » User defined properties to be mapped from JMS to MQ

Post new topic  Reply to topic Goto page 1, 2  Next
 User defined properties to be mapped from JMS to MQ « View previous topic :: View next topic » 
Author Message
dotaneli
PostPosted: Tue Jul 07, 2009 1:13 am    Post subject: User defined properties to be mapped from JMS to MQ Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

Hello everyone.

One of my clients has an application that needs to run both with JMS and MQ Base api. All Java.

He has a need for application defined fields, which are easy to set using JMS:
jmsMsg.setStringProperty("StringPropertyName", "PropertyValue");

When I write a message with these properties, and after that i read it, i can print these values. All is well when using JMS.

However, if I want to see these values on an MQ message, where should I look? Is it in the RFH header? Is it in the body? Can rfhutil see it?
How do I set or get these properties using only MQ Base api? We tried using com.ibm.mq.headers, but this jar does not exist, nor is it traceable through the web.

Any ideas?

Thanks.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jul 07, 2009 1:24 am    Post subject: Re: User defined properties to be mapped from JMS to MQ Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

dotaneli wrote:
where should I look? Is it in the RFH header? Is it in the body? Can rfhutil see it?


In the usr folder of the RFH. As the name suggests, rfhutil is intended to view messages with this header.

dotaneli wrote:
How do I set or get these properties using only MQ Base api?


You'll need to hand craft code to manipulate the RFH. In base MQ terms, it's part of the message.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue Jul 07, 2009 1:41 am    Post subject: Re: User defined properties to be mapped from JMS to MQ Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Vitor wrote:

You'll need to hand craft code to manipulate the RFH.


Theres examples on this forum if you look for them....
Back to top
View user's profile Send private message
dotaneli
PostPosted: Tue Jul 07, 2009 1:52 am    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

10x alot...
But again - i can't see why these fields are not available to me.

This is the relevant code:

jmsMsg = qSession.createBytesMessage();
((BytesMessage)jmsMsg).writeBytes("String message".getBytes());
jmsMsg.setStringProperty("TestProp2", "value of 2");
jmsMsg.setIntProperty("IntPropertyName", 2);
//jmsMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_RF_HEADER_2);
qSender.send(jmsMsg);
jmsMsg = null;
jmsMsg = qReceiver.receiveNoWait();
Enumeration props = jmsMsg.getPropertyNames();
System.out.println("\nTest #2 - Byte message properties, no specific queue parameters");
while (props.hasMoreElements()) {
String element = (String)props.nextElement();
System.out.println(element + " = " +jmsMsg.getStringProperty(element));
}

As you can see, the code puts and gets a message.

If I try to get the message using rfhutil, the <usr> sections remains empty.

Why is that?
Back to top
View user's profile Send private message
anilit99
PostPosted: Tue Jul 07, 2009 2:08 am    Post subject: Reply with quote

Voyager

Joined: 28 May 2009
Posts: 75
Location: London, UK

I was reading all the popular posts the other day, and I came across this thing.

http://www.mqseries.net/phpBB2/viewtopic.php?t=21151

it should be helpful in some way
_________________
"I almost care !"
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue Jul 07, 2009 2:15 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

What happens if you set the properties before you write the message body?

What does the message look like on the queue when viewed through RFHUTIL (ie is this an issue with your putting code which might be fixed by doing as recommended above or is it an issue with the getting code?)
Back to top
View user's profile Send private message
dotaneli
PostPosted: Tue Jul 07, 2009 2:20 am    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

thanks,

but when i set
jmsMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_RF_HEADER_2);

The result is:

javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:622)
at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1827)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1139)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1215)
at MQTesJMStPropertiesMain.main(MQTesJMStPropertiesMain.java:56)

...

Any other ideas..?
Back to top
View user's profile Send private message
anilit99
PostPosted: Tue Jul 07, 2009 2:22 am    Post subject: Reply with quote

Voyager

Joined: 28 May 2009
Posts: 75
Location: London, UK

I am sure some body is gonna say - "post the linked exception" !!
_________________
"I almost care !"
Back to top
View user's profile Send private message
dotaneli
PostPosted: Tue Jul 07, 2009 2:23 am    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

WMBDEV1:

The problem seems to be with the putting code..
Since the program both write and reads, and after reading is is capable of printing the user defined fields, it seems that the JMS-to-MQ conversion is defected, because i did something wrong when writing the message.

As i said, I added:

jmsMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_RF_HEADER_2);

The result is mentioned above..
Back to top
View user's profile Send private message
dotaneli
PostPosted: Tue Jul 07, 2009 2:30 am    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

Which more detailed excpetions are needed?
Are the any other exceptions other than the Java stack?
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue Jul 07, 2009 2:32 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

dotaneli wrote:

As i said, I added:

jmsMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_RF_HEADER_2);

The result is mentioned above..


That wasnt what I asked, please reread my post and makes the changes I requested in my first line.
Back to top
View user's profile Send private message
dotaneli
PostPosted: Tue Jul 07, 2009 2:42 am    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

Well, I did that, just forgot to mention it.

Here is the new piece of code:

jmsMsg = null;
jmsMsg=qSession.createTextMessage();
jmsMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_RF_HEADER_2);
jmsMsg.setStringProperty("StringPropertyName", "PropertyValue");
jmsMsg.setIntProperty("IntPropertyName", 1);
((TextMessage)jmsMsg).setText("String message");
qSender.send(jmsMsg);

Still, same exception:
javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:622)
at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1827)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1139)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1215)
at MQTesJMStPropertiesMain.main(MQTesJMStPropertiesMain.java:56)
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jul 07, 2009 2:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

dotaneli wrote:
Still, same exception:
javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue


You need to extract the linked exception with the WMQ reason code. There are examples in the forum.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue Jul 07, 2009 2:47 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

dont set

jmsMsg.setStringProperty("JMS_IBM_Format", MQC.MQFMT_RF_HEADER_2);
Back to top
View user's profile Send private message
dotaneli
PostPosted: Tue Jul 07, 2009 2:58 am    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

WMBDEV1:

Well - when i DON'T set it, i cannot see the relevant custom fields in the rfhutil...

And - can someone direct me to a post that explains how to extract the linked MQ error code?

10x.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » User defined properties to be mapped from JMS to 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.