Author |
Message
|
ppraveen33 |
Posted: Mon Nov 18, 2013 9:16 am Post subject: Creating MQRFH2 Headers(usr folder) using jms |
|
|
Apprentice
Joined: 26 Jun 2013 Posts: 36
|
HI,
My scenario is keepina File data to a Queue. I am trying to create MQRFH2 Headers using JMS, But I am unable to create usr folder in the headers.In usr my structure should be like
MQRFH2/usr/srcSystem/Country
MQRFH2/usr/srcSystem/serviceId
My CODE is as follows:
String l_dbPropFile = BrokerConstants.getDbPropertyFilePath().trim();
Properties properties = new Properties();
properties.load(new FileInputStream(l_dbPropFile));
FileInputStream inputStream = new FileInputStream(l_oldFile);
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder sb = new StringBuilder();
String line,line1;
MbElement mbElement =
String QMGR=properties.getProperty("QueueManager");
MQQueueManager Qmgr = new MQQueueManager(QMGR);
int openOptions = MQC.MQOO_OUTPUT ;
MQQueue Queue = Qmgr.accessQueue(queuename,openOptions);
MQMessage mqMessage = new MQMessage();
MQMessage sendmsg1 = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();
if(mqfrh2!=null)
{
mqMessage.format = MQC.MQFMT_RF_HEADER_2; // Msg Format
mqMessage.writeString(MQC.MQRFH_STRUC_ID); // StrucId
mqMessage.writeInt4(MQC.MQRFH_VERSION_2); // Version
mqMessage.writeInt4(MQC.MQRFH_STRUC_LENGTH_FIXED_2 ); // StrucLength
mqMessage.writeInt4(MQC.MQENC_NATIVE); // Encoding
mqMessage.writeInt4(MQC.MQCCSI_DEFAULT); // CodedCharacterSetId
mqMessage.writeString(MQC.MQFMT_NONE); // Format (content)
mqMessage.writeInt4(MQC.MQRFH_NO_FLAGS); // Flags
mqMessage.writeInt4(1208); // NameValueCCSID = UTF-8 |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Nov 18, 2013 9:19 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should do none of this using custom Java code from inside broker.
Broker has a node to read the contents of the file.
Broker has a node to write a message to a queue.
Broker has a node to write a JMS message.
You should use all of those functions that are already written.
do not write java code to do this from within Broker/IIB. |
|
Back to top |
|
 |
ppraveen33 |
Posted: Mon Nov 18, 2013 9:21 am Post subject: |
|
|
Apprentice
Joined: 26 Jun 2013 Posts: 36
|
HI,
I am constructing this message in 6.1 So can u elaborate your answer or can you provide me the link so that I will look into it. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Nov 18, 2013 9:29 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
Vitor |
Posted: Mon Nov 18, 2013 9:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ppraveen33 wrote: |
So can u elaborate your answer |
I think this is pretty clear:
mqjeff wrote: |
Broker has a node to read the contents of the file.
Broker has a node to write a message to a queue.
Broker has a node to write a JMS message.
You should use all of those functions that are already written.
do not write java code to do this from within Broker/IIB.
|
You're treating WMB like it's WAS and it hosts Java code. This is conceptually wrong. It's also a one-way ticket to misery to attempt to access any WMQ object (especially in v6.1) outside of the supplied node. This will end badly. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|