Author |
Message
|
MKB |
Posted: Wed Oct 17, 2012 2:08 am Post subject: Accessing MQMD and MQRFH headers in java |
|
|
Newbie
Joined: 17 Oct 2012 Posts: 4 Location: India
|
Hi,
I'm able to read a message from a queue and write message body into a file using MQMessage class.Is there any way to write message body with MQMD and MQRFH headers into a file using java? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 17, 2012 3:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
MKB |
Posted: Wed Oct 17, 2012 8:18 am Post subject: |
|
|
Newbie
Joined: 17 Oct 2012 Posts: 4 Location: India
|
Thanks for the link jeff.
I'm able to access headers like MQRFH with MQHeaderIterator class. Is there any way to access MQMD in similar way?
I have one more question
Is it possible to read MQMD and MQRFH headers from a file and set them while putting a message into queue? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 17, 2012 8:35 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There is no method that is supplied by the MQ Java libraries for serializing headers to or from files, or for serializing any MQ information to and from a file.
That has nothing to do with what is possible or not. What is required is that you think.
If you spend even two minutes looking at the java doc for the MQMessage class it should be apparent how you access the MQMD.
If you are writing Java code and you do not make any effort to read javadoc first to assist in problem solving, then you are not a Java programmer. |
|
Back to top |
|
 |
MKB |
Posted: Wed Oct 17, 2012 9:10 am Post subject: |
|
|
Newbie
Joined: 17 Oct 2012 Posts: 4 Location: India
|
I know how to access elements of MQMD one by one by using MQMessage.
But I'm just searching for a method which reduce my number of lines of code.. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 17, 2012 11:55 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Oh, well, if you just want to simplify your code, then just change all the lines that read the mqmd fields individually into code that calls a method
Code: |
public byte[] flattenMQMD(MqMessage) |
And then write the method. |
|
Back to top |
|
 |
|