Author |
Message
|
franky |
Posted: Tue May 11, 2010 12:23 pm Post subject: Access to custom name/value data in RFH2 via JMS classes ? |
|
|
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 |
|
 |
WMBDEV1 |
Posted: Tue May 11, 2010 2:21 pm Post subject: Re: Access to custom name/value data in RFH2 via JMS classes |
|
|
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 |
|
 |
franky |
Posted: Tue May 11, 2010 10:42 pm Post subject: |
|
|
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
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 |
|
 |
WMBDEV1 |
Posted: Wed May 12, 2010 9:32 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
Quote: |
As you write
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 |
|
 |
franky |
Posted: Wed May 12, 2010 12:03 pm Post subject: |
|
|
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 |
|
 |
WMBDEV1 |
Posted: Wed May 12, 2010 1:24 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Wed May 12, 2010 2:14 pm Post subject: |
|
|
 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 |
|
 |
franky |
Posted: Thu May 13, 2010 5:04 am Post subject: |
|
|
Newbie
Joined: 11 May 2010 Posts: 4
|
|
Back to top |
|
 |
fjb_saper |
Posted: Thu May 13, 2010 2:23 pm Post subject: |
|
|
 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><Subfolder1><Tagx>SomeValue</Tagx></Subfolder1></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 |
|
 |
|