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 » Setting MQMD.Format from a JMS API

Post new topic  Reply to topic
 Setting MQMD.Format from a JMS API « View previous topic :: View next topic » 
Author Message
nelson
PostPosted: Tue Oct 13, 2015 6:03 am    Post subject: Setting MQMD.Format from a JMS API Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Hi all,

We want to set the MQMD.Format from a java application running on WAS 8.5.5 using native JMS libraries and the Connection Factory and MQ resources managed by WAS:

Code:

TextMessage message = session.createTextMessage(xml);
...
message.setStringProperty("JMS_IBM_Format", "MQFMT_STRING");
...


The documentation says you need to set JMS_IBM_Format property to MQFMT_STRING, that internally will be mapped against the MQMD.Format field.

In WAS, in the queue configuration, the format property body is "MQ" and the reply is "MQMD".

We have made a lot of tests and combinations of these properties, but no success... In MQ, the format is always set as blank...

Have any of you a clue on how to set the format?

Any help is very appreciated.

Thanks in advance.
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Oct 13, 2015 6:20 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

Options to generate standard MQSTR messages from JMS application.

1. Set the output MQ queue name URI (sometimes called destination resource) like this (rather than having just the queue name) - don't code the brackets []

queue:///[THE.MQ.QUEUE.DEFINITION]?targetClient=1

-------------------------- or ---------------------------

2. In the program code - set the target client on the queue object to NON JMS.

q.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);

------------------- or ---------------

3. In the JNDI or properties - do the same as option 2 - I don’t know much about how to do this.
NB: MQJMS_CLIENT_NONJMS_MQ equates to the value 1

--------------------------------------

I would suggest option 2.
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.
Back to top
View user's profile Send private message
nelson
PostPosted: Tue Oct 13, 2015 7:34 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Thank you zpat for your reply.

For the second option, the setTargetClient method can only be used with com.ibm.mq.jms.MQQueue object... but.. we are not using at all com.ibm.mq.jms library... any workaround?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 13, 2015 7:59 am    Post subject: Reply with quote

Grand High Poobah

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

So you are using JMS with probably a WAS type JNDI.
2 things are needed to achieve what you want to do.

  1. Define the message as a javax.jms.TextMessage i.e. use
    Session.createTextMessage()
  2. Set the queue to use targetClient MQ.
    You can either define that in the JNDI when you set up the queue
    Or if using reading queue names from properties make sure you use the URI form:
    String qname="queue:///QUEUENAME?targetClient=1";
    Session.createQueue(qname);

If you are using pub/sub I would suggest that the application uses TextMessage and the receiving application codes for "properties in Handle" in order to not get an RFH2 header...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nelson
PostPosted: Tue Oct 13, 2015 11:34 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

fjb_saper wrote:

You can either define that in the JNDI when you set up the queue


How? we have tested a lot of combinations in the WAS configuration...

Thanks a lot for your help!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 13, 2015 11:52 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

put the target client property in the url in the jndi.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 13, 2015 3:23 pm    Post subject: Reply with quote

Grand High Poobah

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

nelson wrote:
fjb_saper wrote:

You can either define that in the JNDI when you set up the queue


How? we have tested a lot of combinations in the WAS configuration...

Thanks a lot for your help!

Did you switch the destination from type JMS to type MQ? And verify that it took in the config file after save? Obviously you'll have to bounce the server for the new config to take effect...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nelson
PostPosted: Thu Oct 15, 2015 4:12 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

fjb_saper wrote:
nelson wrote:
fjb_saper wrote:

You can either define that in the JNDI when you set up the queue


How? we have tested a lot of combinations in the WAS configuration...

Thanks a lot for your help!

Did you switch the destination from type JMS to type MQ? And verify that it took in the config file after save? Obviously you'll have to bounce the server for the new config to take effect...


That was the trick, thanks a lot!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Setting MQMD.Format from a JMS API
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.