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 » How to access <usr> folder using JMS

Post new topic  Reply to topic
 How to access <usr> folder using JMS « View previous topic :: View next topic » 
Author Message
chrisgclark
PostPosted: Wed Apr 15, 2009 8:28 am    Post subject: How to access <usr> folder using JMS Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

Hi,

I have a Java JMS application that reads messages from a MQ queue. My application can successfully read a message and pull out the JMS headers (e.g. JMSDeliveryMode, JMSPriority etc) and the message body, but I can not access the <usr> folder part of the message.

I am placing messages on a queue using RFHutil. Under the RFH tab I am ticking 'Include RFH V2 Headers' and 'usr', and under the usr tab I have test1=1. I can see the <usr><test1>1</test1></usr> in the message if I browse the queue using MQExplorer, so I think I'm setting the usr folder correctly.

I have outputted the whole of message.getPropertyNames() enumeration (as discussed at topic ' JMS passing entire Application data <usr> block', sorry can't post links as first post) but my usr fields are not under there. My message body also does not contain my usr fields.

I've also read on the MQ v7 info center you need to set WMQ_MESSAGE_BODY to WMQ_MESSAGE_BODY_MQ, but I am using v6MQ and do not know if this is relevant/how to set this value.

How can I get access to the usr folder using the JMS API?

Any help/pointers would be much appreciated as I am fairly new to JMS programming. Thanks
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed Apr 15, 2009 8:41 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

message.getStringProperty("test1") is what you should be using.

Which version of RFHUtil are you using?

Are you sure the RFH2 header is formed correctly or is the usr folder in the body of the message when you view it from your java code?

In version 6 I found it didnt always write the RFH2 headers but if you say you can see them in MQ Explorer I guess this aint it.
Back to top
View user's profile Send private message
chrisgclark
PostPosted: Thu Apr 16, 2009 2:23 am    Post subject: Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

Hi,

Thanks for your reply. I have tried the message.getStringProperty("test1") method but it is returning null, even though I can see <usr><test1>1</test1></usr> above my message body when viewing using MQ Explorer. Also, if I browse the test message using RFH util the message still contains the usr folder so the header looks valid.

The usr folder is not in the message body when I output using JMS. I am outputting the body using the following code and can't see the usr folder:

long i = message.getBodyLength();
int num = ((int) i );
bytpe[] buffer = new byte[num]
message.readBytes(buffer)
String payload = new String(buffer)
//then output payload.... payload correctly contains the message body but no usr folder.

I am using RFHUtil v5.0.5. Viewing my test message in MQ Explorer I can see the usr folder below the RFH2 headers (however the RFH2 header is not readable in MQ Explorer, displays as hex/random chars, but I can see its there).

Any ideas on why I can not access the usr folder? Cheers
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu Apr 16, 2009 2:39 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Sounds very strange.

In RFHUTIL, are you also adding an mcd folder (as well as selecting the usr and version 2 boxes)?

If so, then maybe downloading the latest RFHUTIL version may help?

As a last resort, at times like this i've ended up using an app like frhed to check byte by byte the contents of the message to ensure it is well formed (but this really is a last resort).
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Apr 16, 2009 1:54 pm    Post subject: Reply with quote

Grand High Poobah

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

Could be another CCSID issue. Verify in the manual if the ccsid used in the value pair has been set correctly on the RFH header and is contained in the sparse list of allowed values.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
chrisgclark
PostPosted: Fri Apr 17, 2009 2:23 am    Post subject: Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

Hi,

Thanks for the replys. The issue turned out to be with RFHutil. I wrote a simple JMS java app to send a test message in, setting a field in the usr folder with message.setStringProperties("test1", "1"). I then read this test message with the JMS application I was having problems with and I could access the usr field (using message.getStringProperty("test1"). If I send the test message in with RFHUtil (even with setting RFH2header and usr folder) then I can still not access the usr field.

Browing the test messages using MQ explorer I noticed the message sent in with my JMS app had some extra header information over the RFHUtil message, the extra bits are shown in bold:
RFH....
<mcd><Msd>jms_test</Msd></mcd> ...T <jms><Dst>queue://......</Dst><Tms>......</Tms><Dlv>.</Dlv></jms><usr><test1>1</test1></usr>
Body...

This extra header information has allowed my JMS application to access the usr folder. So, if you have this problem beware of using RFHUtil for testing.
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Apr 17, 2009 2:44 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

I am using RFHUTIL V7.

There are checkboxes on the RFH tab to enable generation of the RFH V2 Header folders such as mcd, jms, usr, PubSub, pscr, other.

Which version of RFHUTIL were you using?
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Fri Apr 17, 2009 3:46 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

WMBDEV1 wrote:

In RFHUTIL, are you also adding an mcd folder (as well as selecting the usr and version 2 boxes)?


The mcd folder is mandatory and without it explains why you had issues. For info, I think it will work from RFHUtil without the jms folder though.

Quote:
The issue turned out to be with RFHUtil


This isnt strictly true..... I'll leave you to work out where the issue really was

And zpat, we have already been told the version was 5.0.5
Back to top
View user's profile Send private message
chrisgclark
PostPosted: Fri Apr 17, 2009 4:23 am    Post subject: Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

Thanks for the info

If I get some time I'll try setting the mcd folder (as well as the usr folder) in RFHUtil and see if that works.
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 » How to access <usr> folder using JMS
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.