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 » MessageType Property via Java Program

Post new topic  Reply to topic
 MessageType Property via Java Program « View previous topic :: View next topic » 
Author Message
logonaniket
PostPosted: Wed Apr 15, 2015 9:29 am    Post subject: MessageType Property via Java Program Reply with quote

Novice

Joined: 12 Dec 2013
Posts: 17

Hi Guys!

I am trying to build a testing framework for which I need help!

I am trying to push a message via JAVA Program which goes into the MQ queue and further to the Message Flow.

Message Flow fetches the message and the depeding upon the property: InputRoot.Properties.MessageType it does some operations...

I have tried every single way but I am unable to pass this via Java Program! Can someone help?

-- I know there is a function called "messageType" but it takes int values. Also, even if I pass an int value to it, it doesn't reflect in my message flow. (Checked via trace)

Code:
p.load(new FileInputStream("details.properties"));
qManager = p.getProperty("oQM");
queue = p.getProperty("iQueue");
host = p.getProperty("oHOST");
channel = p.getProperty("oCHANNEL");
p1 = Integer.parseInt(p.getProperty("oPORT"));
MQEnvironment.hostname = host;
MQEnvironment.channel = channel;
MQEnvironment.port = p1;
message = new MQMessage();
pmo = new MQPutMessageOptions();
qMgr = new MQQueueManager(qManager);
openOptions = CMQC.MQOO_OUTPUT |  CMQC.MQPMO_FAIL_IF_QUIESCING ;
Test = qMgr.accessQueue(queue, openOptions);
   
//pmo.options = CMQC.MQPMO_FAIL_IF_QUIESCING | CMQC.MQPMO_NO_SYNCPOINT;
 
if (header_message_format != null) {
    message.format = "MQRFH2";
    message.encoding = 785;
    message.characterSet = 500; 
   
    message.setStringProperty("Set", "B03B7U0002001");
    if (header_event != null) {
        message.setStringProperty("MessageType", header_event);
        message.setObjectProperty("Lob", header_lob);
    }
}
message.writeString(outMsg); 
Test.put(message);
Test.close();


P.S: Pardon me if I repeated this question in the sub forum.


Trace:
Code:
2015-04-15 18:16:46.208044       10   UserTrace   BIP2539I: Node 'Matcher': Evaluating expression ''InputRoot.Properties.MessageType'' at ('Matcher.Main', '31.43'). This resolved to ''InputRoot.Properties.MessageType''. The result was ''ROW... Root Element Type=50331648 NameSpace='' Name='MessageType' Value=''''.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 15, 2015 9:37 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

How does MessageType get set if not by your proposed testing framework, i.e. how does it get set when the flow is used "for real"?

That's what you need to duplicate.

One possible clue is that you're creating (or attempting to create) an RFH2 header. Depending on the version of WMQ, and how the queue manager is set, that may not be what you need.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Apr 15, 2015 10:46 am    Post subject: Reply with quote

Grand High Poobah

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

Isn't the InputRoot.Properties.MessageType vastly different depending on whether the message was put by an application (JMS, java, etc...) or by the broker? I am thinking here about how the content of the RFH2 may override the parsing...

Best bet would be to keep the parsing at the input node as BLOB and use a reset content node to always get the parsing you want...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
logonaniket
PostPosted: Thu Apr 16, 2015 12:25 am    Post subject: Reply with quote

Novice

Joined: 12 Dec 2013
Posts: 17

Unfortunately I cannot modify the message flow!

Currently, the testing framework which is in use; pushes the message via "mqtest" utility
Code:
mqtest -f fire.properties


file.properties contains:
Code:
[header]
qname=<QUEUE_NAME>
qmgr=<QM_NAME>
encoding=785
codepage=500
rfh=2
RFH_CCSID=500
RFH_ENCODING=785
RFH_NAME_CCSID=1208
RFH_DOMAIN=MRM
RFH_MSG_SET=<MSG_SET_NAME>
RFH_MSG_TYPE=<MESSAGE_TYPE_OR_EVENT_TYPE>
RFH_MSG_FMT=CWF
<usr><Lob>R</Lob></usr>
[filelist]
abc.msg


I want to achieve this via JAVA program.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Apr 16, 2015 4:45 am    Post subject: Reply with quote

Grand High Poobah

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

Good Luck. The properties on the RFH2 header you are trying to change are not user properties and as such hard to reach in a JMS program. Any other program, you can set the RFH2 properties, but you will have to calculate the length of the header and adjust it within a 4 byte offset etc ...
So doing this in java is not so trivial...
Easiest would be to set a pre-processing flow that has the parser and message set on the inbound node and sets the RFH with the user fields. The other fields get then automatically filled in at serialization time. Potentially send the message with JMS just filling in the content and the Lob property with the value "R". The pre-processing flow will do the rest.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Apr 16, 2015 6:59 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

MessageType is not an application field, and you shouldn't need to set it. IIB will use it to override the settings on an input node in terms of what is used to parse the data you are sending it, and you can ignore it outside of IIB.

The data you actually put in the message will instruct IIB on how to parse it, and thus what message type and set is being used....

If you are setting MQ properties, you shouldn't create or indicate that the message has an MQRF2. MQ should handle that for you - and IIB will also translate that either way.

If you want to carry application metadata, then using MQ properties is the correct thing to do.
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 » MessageType Property via Java Program
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.