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 » Access to custom name/value data in RFH2 via JMS classes ?

Post new topic  Reply to topic
 Access to custom name/value data in RFH2 via JMS classes ? « View previous topic :: View next topic » 
Author Message
franky
PostPosted: Tue May 11, 2010 12:23 pm    Post subject: Access to custom name/value data in RFH2 via JMS classes ? Reply with quote

Newbie

Joined: 11 May 2010
Posts: 4

Is there any way to access MQRFH2 folders other than those for JMS from the JMS classes ?

I'm writing a servlet that has to talk to a backend application implemented as WMB flow.
The servlet should make use of the appliation server definitions like QueueConnectionFactory and Queues and is therefore forced to use JMS instead of MQ classes for Java, correct ?

The flow provides MQ messages containing a payload in the data section of the message and metadata in a custom folder within the name/value data of the MQRFH2.

For sending information to the flow I found a way to use a JMSBytesMessage, set some JMS properties that get mapped into the MQMD and then construct a complete MQRFH2 'byte by byte' starting with the RFH2 struct id.

But for receiving information in the servlet I have no idea how to access the custom MQRFH2 folder. It seems that only known JMS folders are mapped to JMS properties and the remaining MQRFH2 data is not accessible, I tried with readBytes() from the JMSBytesMessage returned by QueueReceiver.receive() method.
I haven't seen a difference no matter what the queue I'm reading from has set target client to MQJMS_CLIENT_JMS_COMPLIANT or MQJMS_CLIENT_NONJMS_MQ...

BTW, the solution would have to work with MQ 6.

Has anyone an idea how I could continue ?

kind regards, Frank
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue May 11, 2010 2:21 pm    Post subject: Re: Access to custom name/value data in RFH2 via JMS classes Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

franky wrote:
Is there any way to access MQRFH2 folders other than those for JMS from the JMS classes ?


Yes, but you will be re-inventing the wheel if you do this. I'd stick to jms if I was you.

Quote:

For sending information to the flow I found a way to use a JMSBytesMessage, set some JMS properties that get mapped into the MQMD and then construct a complete MQRFH2 'byte by byte' starting with the RFH2 struct id.

But for receiving information in the servlet I have no idea how to access the custom MQRFH2 folder. It seems that only known JMS folders are mapped to JMS properties and the remaining MQRFH2 data is not accessible, I tried with readBytes() from the JMSBytesMessage returned by QueueReceiver.receive() method.


If you are using JMS messages, whats wrong with using the getStringProperty / setStringProperty (or other getters / setters for the type of value being set)? This is part of the JMS API and should do what you want.
Back to top
View user's profile Send private message
franky
PostPosted: Tue May 11, 2010 10:42 pm    Post subject: Reply with quote

Newbie

Joined: 11 May 2010
Posts: 4

Hi WMBDEV1,
thanks for your reply.
Unfortunately I have no chance to change the backend flow, and that flow was not written to deal with JMS messages (just uses a non-JMS name/value entry in RFH2). So I have to use its given interface in my servlet.
Therefore I guess I will have to re-invent the wheel

The only alternative I see is to use MQ classes for Java, but then I have to re-invent even more wheels (like all the connection stuff as pooling, SSL, ...) and still have to create / parse MQRFH2 byte by byte (as MQ6 does not yet have the RFH2 class of MQ7). Furthermore, using MQ classes for Java feels somehow strange in an app server environment...

As you write
Quote:
Yes, but ...
it sounds like there is a way to stay with JMS. Could you give me some more details ? I really would appreciate your help.

kind regards, Frank
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed May 12, 2010 9:32 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Quote:

As you write
Quote:
Yes, but ...
it sounds like there is a way to stay with JMS. Could you give me some more details ? I really would appreciate your help.


The alternative I was eluding to was to use the base classes, something which it seems you are aware of already.

What happens if you read one of these messages through jms then? Do you get errors or do the API calls just not work?
Back to top
View user's profile Send private message
franky
PostPosted: Wed May 12, 2010 12:03 pm    Post subject: Reply with quote

Newbie

Joined: 11 May 2010
Posts: 4

Quote:
What happens if you read one of these messages through jms then? Do you get errors or do the API calls just not work?

All API calls work, but ....:
The approach I tried is to cast the Message object retrieved from QueueReceiver.receive() to a JMSBytesMessage and to use its getBodyLength() and readBytes() methods - but length is 0 (as my test message just had a MQRFH2 and no payload in the message body).
Dumping the JMSBytesMessage itself just shows the usual JMS properties mapped from MQMD like JMSMessageID.

Is there any way to force JMS not to map MQRFH2 JMS folders and instead provide the complete RFH2 as byte array, or force it to map also unknown RFH2 folders somehow ?
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed May 12, 2010 1:24 pm    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

franky wrote:

Is there any way to force JMS not to map MQRFH2 JMS folders and instead provide the complete RFH2 as byte array,


Not that I know of.

Quote:
or force it to map also unknown RFH2 folders somehow ?


I'm guessing by unknown,you mean they are in the usr folder In which case they should be understood by the API calls, if they are not then i'm not really sure what other advice I can offer...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed May 12, 2010 2:14 pm    Post subject: Reply with quote

Grand High Poobah

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

Quote:
(just uses a non-JMS name/value entry in RFH2)

Can you be a lot more detail oriented and specific on that point?
What does the RFH2 look like?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
franky
PostPosted: Thu May 13, 2010 5:04 am    Post subject: Reply with quote

Newbie

Joined: 11 May 2010
Posts: 4

Here the details of the MQRFH2 I'm trying to read in the servlet:
As the message originates from msg flow let me refer to the broker definition of the RFH2:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/aq06930_.htm

After the fixed portion of the header (behind the NameValueCCSID field) I have the 4 bytes NameValueLength followed by NameValueData like this:
<ComAbcDef><Subfolder1><Tagx>SomeValue</Tagx></Subfolder1></ComAbcDef>
(according to the broker specification a: "a variable-length character string containing data that is encoded using an XML-like structure" created by the backend message flow).

You see, no JMS folder, not even <usr>. And in addition because of its 'XML-like structure' more than JMS allows (http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/uj25440_.htm), as far as I understand.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu May 13, 2010 2:23 pm    Post subject: Reply with quote

Grand High Poobah

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

you need for the broker folks to change the RFH.
They should use the usr folder and enter the property-value pairs...
So you could have <usr><ComAbcDef>&lt;Subfolder1&gt;&lt;Tagx&gt;SomeValue&lt;/Tagx&gt;&lt;/Subfolder1&gt;</ComAbcDef></usr> meaning that your xml would get escaped values...and would need to be assigned at the right level....
Up to your parsing to get it decoded right...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Access to custom name/value data in RFH2 via JMS classes ?
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.