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 » Sending message with MQFMT_NONE becomes MQHFR2

Post new topic  Reply to topic Goto page 1, 2  Next
 Sending message with MQFMT_NONE becomes MQHFR2 « View previous topic :: View next topic » 
Author Message
stenix
PostPosted: Wed Dec 08, 2010 4:18 am    Post subject: Sending message with MQFMT_NONE becomes MQHFR2 Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 08, 2010 3:10 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
stenix
PostPosted: Thu Dec 09, 2010 12:39 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 09, 2010 4:55 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
stenix
PostPosted: Thu Dec 09, 2010 5:58 am    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Thu Dec 09, 2010 6:29 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

q.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
Back to top
View user's profile Send private message
stenix
PostPosted: Thu Dec 09, 2010 6:58 am    Post subject: Reply with quote

Novice

Joined: 08 Dec 2010
Posts: 12

Quote:
q.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);


But I am not using the jms API, I am using the java base api and there is no such method on the MQQueue class:

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0m0/index.jsp?topic=/com.ibm.mq.java.doc/com/ibm/mq/MQQueue.html

...or am I missing something?

Please note that this problem only occur when I use my client code built with MQ 7 in a MQ 6 environment. If I run it in a MQ 7 environment it works fine.

Best regards
contact admin
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Dec 09, 2010 7:10 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Dec 09, 2010 7:29 am    Post subject: Reply with quote

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
View user's profile Send private message
stenix
PostPosted: Thu Dec 09, 2010 7:30 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Dec 09, 2010 7:34 am    Post subject: Reply with quote

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
View user's profile Send private message
stenix
PostPosted: Thu Dec 09, 2010 8:04 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Dec 09, 2010 8:26 am    Post subject: Reply with quote

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
View user's profile Send private message
stenix
PostPosted: Sun Dec 12, 2010 11:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Dec 13, 2010 6:05 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » Sending message with MQFMT_NONE becomes MQHFR2
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.