Author |
Message
|
notoneword |
Posted: Tue Jun 28, 2011 6:08 pm Post subject: RFH2 header with <usr> folder, issue with MQHeaderIter |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
No, I'm not using JMS classes (just wanted to get that out of the way.)
We noticed a strange issue in our testing when browsing a message - certain RFH2 headers don't get picked up by MQHeaderIterator. narrowed it down to a message where the RFH2 header had a NameValueData containing a <usr> folder.
.. and the issue seems directly related to this usr folder. I changed the name value data to be just '<usr></usr>' and it fails. I alter that to '<test></test>' and the header is picked up by MQHeaderIterator. ?
I'll probably end up opening a PMR for this, but wanted to see if anyone had a notion...
Here's the code where we're reading the headers. On the message that fails, it never goes into the while loop.
Code: |
MQHeaderIterator it = new MQHeaderIterator(msg);
while (it.hasNext()) {
MQHeader header = it.nextHeader();
String type = header.type();
if (MQRFH_STR.equals(type)) {
headersList.add(getRFHMap((MQRFH) header));
} else if (MQRFH2_STR.equals(type)) {
headersList.add(getRFH2Map((MQRFH2) header));
} else if (MQDLH_STR.equals(type)) {
headersList.add(getDLHMap((MQDLH) header));
} else if (MQXQH_STR.equals(type)) {
headersList.add(getXQHMap((MQXQH) header));
} else {
log.error(this + " - mapMessageHeaders: Unsupported type("
+ type + ")");
}
} |
|
|
Back to top |
|
 |
notoneword |
Posted: Tue Jun 28, 2011 6:21 pm Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
I just realized this is in the wrong forum, should be MQ java API/JMS. Can someone please move it there? thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 28, 2011 7:44 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
So moved.
Let's see a few points
- You state that you are not using JMS/XMS
- you state that you are having problems with the usr folder of the RFH2 when present
- You never said how the RFH with the usr folder was built, nor if it had the correct justification (4 bytes)?
So before opening a PMR I would use RFHUtil or a JMS app to build an RFH2 header with properties and see if that shows up in your iterator...
If if does not, it is PMR time. If it does, than your RFH2 was obviously not built properly and it is back to the drawing board for you.
If you are using V7, try setting the V7 properties and putting the message to a queue with propctl set to RFH2, then look at the message again.
If there is a problem, open a PMR. If not, again it's back to the drawing board for you!.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 29, 2011 4:53 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Thanks for the suggestions!
As mentioned, I am getting RFH headers to show up using the MQHeaderIterator (when not including usr folder), so I'm pretty certain that I'm constructing the headers correctly. And I'm padding the strings to multiples of 4, e.g. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 29, 2011 5:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
notoneword wrote: |
And I'm padding the strings to multiples of 4, e.g. |
It's not the padding, it's the alignment that matters. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mvic |
Posted: Wed Jun 29, 2011 11:24 am Post subject: Re: RFH2 header with <usr> folder, issue with MQHeader |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
I am just interested: why are you building your own RFH2? Why not use the get-property and set-property methods on the MQMessage object?
Building your own RFH2 is not a fun way to spend a day. IMHO |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 29, 2011 11:31 am Post subject: Re: RFH2 header with <usr> folder, issue with MQHeader |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mvic wrote: |
Building your own RFH2 is not a fun way to spend a day. |
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 29, 2011 12:51 pm Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
I may look into doing it that way, assuming it doesn't require all Qmgrs be V7 or better - does it?
But, back to the question at hand. RFH headers, written and read successfully, that's all working, using the provided API. UNTIL I pass a usr folder. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jun 29, 2011 1:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
notoneword wrote: |
I may look into doing it that way, assuming it doesn't require all Qmgrs be V7 or better - does it? |
JMS/XMS works under v6
notoneword wrote: |
But, back to the question at hand. RFH headers, written and read successfully, that's all working, using the provided API. UNTIL I pass a usr folder. |
Because you've got the alignment wrong.
Trying to get an RFH2 correct is not easy. This is why IBM wrapped it in the JMS support provided with WMQ, and invented XMS for non-Java.
You can successfully create an RFH2 without using these facilities. But will your newly invented wheel be any rounder than the one IBM supplies? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 29, 2011 1:12 pm Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Quote: |
Because you've got the alignment wrong. |
Hmm, you seem pretty sure of this I'm curious what you're basing that on? Did you see that I am writing RFH headers fine with other folder names, and this only occurs with <usr>? If that's what indicates it's an alignment issue fine, just trying to figure out how/why that's known.
thanks |
|
Back to top |
|
 |
mvic |
Posted: Wed Jun 29, 2011 3:06 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
As others have said, originate a message using JMS or similar. Then compare the bytes of a successful case, generated in the official way, with the bytes of your failing case.
(Also make sure you are using a recent fix pack.. always..)
If you want lots of detail, start here and/or pages around about it: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzak.doc/fr43020_.htm
Please look at Vitor's point about wheels and their never-improving roundness. Is there something extra you need in the library of code you are building that is not already provided by IBM? I don't think you have said why you are doing this. |
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 29, 2011 4:49 pm Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Ok, thanks. Helpful link there. And yes, I'm using FP 7.0.1.5.
I was starting to think the answer in this forum always seems to be 'use JMS' and maybe there's good reason for that, eh?
Well, initially my jefe told me not to use JMS and that we'd be able to use the Java MQ API. And I have, pretty successfully for the most part, until this current wrinkle. If I have time, I'll get the JMS jars and see what I can see, but I'm not sure when that will be.
As always thanks for all the replies and help, they're appreciated! |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 29, 2011 8:27 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
notoneword wrote: |
Ok, thanks. Helpful link there. And yes, I'm using FP 7.0.1.5.
I was starting to think the answer in this forum always seems to be 'use JMS' and maybe there's good reason for that, eh?
Well, initially my jefe told me not to use JMS and that we'd be able to use the Java MQ API. And I have, pretty successfully for the most part, until this current wrinkle. If I have time, I'll get the JMS jars and see what I can see, but I'm not sure when that will be.
As always thanks for all the replies and help, they're appreciated! |
As mentioned before (you have to learn to pay attention...) build your message in V7 using message properties. Do not build an RFH header.
Set the property control of the destination to compat or RFH2. Put the message to the queue and use whatever tool you need to read it.
You should notice that the message now shows with an RFH if retrieved / browsed with a V6 tool (propctl=compat) or shows an RFH (propctl=RFH2)
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 30, 2011 4:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
notoneword wrote: |
If that's what indicates it's an alignment issue fine, just trying to figure out how/why that's known. |
Because the RFH2 header has specific, documented rules for the alignment of it's components & there's nothing in your posted code that seems to be allowing for or catering to this.
I'm also assuming your earlier question regarding JMS/XMS running under earlier versions than v7 indicates you're using such a version. If you are in fact using v7 I fully endorse my most worthy associate's exhortation to use message properties.
Given that you're obviously planning your migration to v7 already, it's potentially worth using v7 now & using the settings as indicated to give backwards compatibility. It'll save you time later. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
notoneword |
Posted: Thu Jun 30, 2011 5:46 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Ok, thanks for the advice guys. First chance I get I'll be trying out the set*Property methods and see if they'll do what I need to do, and I'll drop a note back on this thread when I do - thanks again. |
|
Back to top |
|
 |
|