Author |
Message
|
stenix |
Posted: Wed Dec 08, 2010 4:18 am Post subject: Sending message with MQFMT_NONE becomes MQHFR2 |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
Hi,
I am using the java api on Websphere 7.0.1 to send mq messages of both text and binary content. When I send a binary message, I set the message format to MQFMT_NONE. This works fine as long as I am using Websphere 7, the message format is then set to an empty string.
However when I take my client and run it on a Websphere 6 environment the message format becomes MQHFR2 when the message is placed on the queue. The target application becomes confused. I use the ibm jar files provided from Websphere 7 together with my client but run it against a Websphere 6 environment.
Now to the questions:
1. Is there any way to avoid this strange behavior?
2. Is it correct to use MQFMT_NONE for binary messages or should I use something else?
3. Is it correct to use the Websphere 7 jar files while running against Websphere 6?
Thank you for your attention
Best regards
stenix |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 08, 2010 3:10 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
As you're talking about WAS I expect that you're really using the JMS API and not the java base API.
The RFH attribute for the messages is controlled in JMS by the destination.
Review the JNDI for the Destination that is receiving the message with the RFH header and make sure that the targetClient attribute says MQ and not JMS. (targetClient=1). The destination may also be supplied in form of an URI. This attribute needs to be in the URI string.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
stenix |
Posted: Thu Dec 09, 2010 12:39 am Post subject: |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
Hi,
No, I am not using the JMS API, I am using the java base API and that is why I was so surprised to see the MQHRF2 as message format. There is no JMS involved in any of the parts in this case.
This is the code I use to send the last segment of the message:
Code: |
...
this.message = new MQMessage();
this.message.format = sendAsText ? MQConstants.MQFMT_STRING : MQConstants.MQFMT_NONE;
message.write(data);
message.messageFlags = MQConstants.MQMF_LAST_SEGMENT | MQConstants.MQMF_SEGMENTATION_ALLOWED;
getDestination().put(message, this.messageOptions);
...
|
I copied the code out of its context so I hope I did not miss any part.
Usually there is only one final segment but sometimes the messages are large so they become segmented.
Best regards
stenix |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Dec 09, 2010 4:55 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
stenix wrote: |
Hi,
No, I am not using the JMS API, I am using the java base API and that is why I was so surprised to see the MQHRF2 as message format. There is no JMS involved in any of the parts in this case.
This is the code I use to send the last segment of the message:
Code: |
...
this.message = new MQMessage();
this.message.format = sendAsText ? MQConstants.MQFMT_STRING : MQConstants.MQFMT_NONE;
message.write(data);
message.messageFlags = MQConstants.MQMF_LAST_SEGMENT | MQConstants.MQMF_SEGMENTATION_ALLOWED;
getDestination().put(message, this.messageOptions);
...
|
I copied the code out of its context so I hope I did not miss any part.
Usually there is only one final segment but sometimes the messages are large so they become segmented.
Best regards
stenix |
You have to be more careful. I believe you are confusing segmentation and grouping. In grouping you control the group with last message in group and all those flags. In a segmentation put (AFAIK) you just set the segmentation allowed flag and let the qmgr do the splicing and dicing.
As for the rest why are you using java base in a J2EE container?
Can you share the reason with us?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
stenix |
Posted: Thu Dec 09, 2010 5:58 am Post subject: |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
Hi,
Sorry, there was a bit of confusion here I think. I am using Websphere MQ 7.0.1, not the application server. I have never used the application server so I was not aware of the abbreviaiton WAS.
This is a plain old java application.
As for the segmentation, I will remove the explicit segmentation from the code as you suggested but that is another issue.
Best regards
contact admin |
|
Back to top |
|
 |
zpat |
Posted: Thu Dec 09, 2010 6:29 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
q.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ); |
|
Back to top |
|
 |
stenix |
Posted: Thu Dec 09, 2010 6:58 am Post subject: |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
|
Back to top |
|
 |
mqjeff |
Posted: Thu Dec 09, 2010 7:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Try setting CMQC.MQGMO_PROPERTIES_FORCE_MQRFH2
Edit: Err. Try setting the equivalent PMO property. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Dec 09, 2010 7:29 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Okay.
There isn't an equivalent PMO option.
You can try setCommandLevel to set CMQC.MQCMDL_LEVEL_600 ...
Otherwise the issue is that the v7 interface is detecting that the qmgr can't support Message Properties, and thus building an MQRFH2 to hold the properties. it's slightly possible that if you can remove every single message property from the message, then you won't get an MQRFH2.
But you may just have to build your app at v6, and use that to connect to both v6 and v7 to get a consistent behavior. |
|
Back to top |
|
 |
stenix |
Posted: Thu Dec 09, 2010 7:30 am Post subject: |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
Quote: |
Try setting CMQC.MQGMO_PROPERTIES_FORCE_MQRFH2
Edit: Err. Try setting the equivalent PMO property. |
I cannot find any equivalent PMO and my problem is rather the opposite. The target is a MQ application which does not recognise MQFRH2 headers so I want the message format to be blank (MQFMT_NONE).
Best regards
stenix |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Dec 09, 2010 7:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
stenix wrote: |
Quote: |
Try setting CMQC.MQGMO_PROPERTIES_FORCE_MQRFH2
Edit: Err. Try setting the equivalent PMO property. |
I cannot find any equivalent PMO and my problem is rather the opposite. The target is a MQ application which does not recognise MQFRH2 headers so I want the message format to be blank (MQFMT_NONE). |
Right, again, the issue is with MQ v7 message properties needing to be represented as an MQRFH2. My hope with the non-existent PMO option was that it would notice that you aren't setting any message properties (right?) and thus wouldn't create an MQRFH2 in the first place.
but see my last response above this. |
|
Back to top |
|
 |
stenix |
Posted: Thu Dec 09, 2010 8:04 am Post subject: |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
The thing is that I do set some message properties but it was not part of the code snippet I posted earlier. I use ordinary MQ properties like this:
Code: |
this.message.setStringProperty("jobId", strsJobId);
|
I will test without these properties and see what happens.
I will also test to build the code with MQ 6 to see if that makes any difference.
I'll keep you posted.
Best regards
stenix |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Dec 09, 2010 8:26 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Right, so those properties have to be stored in the message somewhere.
On MQv6, the only place that they can be stored in an MQRFH2 header on the message.
In MQv7, they can be stored in the Message Properties, which is separate from the content of the message.
So the code is doing what you've told it to do. |
|
Back to top |
|
 |
stenix |
Posted: Sun Dec 12, 2010 11:45 pm Post subject: |
|
|
Novice
Joined: 08 Dec 2010 Posts: 12
|
Hi again,
We have done some further testing and it turns out that the message format is set to MQRFH2 in MQ 6 regardless if there are properties in the message or not.
It also turns out that the message format is set to MQRFH2 also when I explicitly set the format to be MQFMT_STRING. Are there any other information that don't fit to the message structure of MQ 6 and thus needs the MQRFH2 header? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Dec 13, 2010 6:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
stenix wrote: |
Hi again,
We have done some further testing and it turns out that the message format is set to MQRFH2 in MQ 6 regardless if there are properties in the message or not.
It also turns out that the message format is set to MQRFH2 also when I explicitly set the format to be MQFMT_STRING. Are there any other information that don't fit to the message structure of MQ 6 and thus needs the MQRFH2 header? |
If you are doing pub/sub. This is also handled via the RFH header in V6.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|