Author |
Message
|
leehairy |
Posted: Fri Aug 04, 2006 6:07 am Post subject: Extract data from MQFMT_XMIT_Q_HEADER message |
|
|
Novice
Joined: 04 Aug 2006 Posts: 13
|
Can anyone offer me some advice please!!!
I am using the MQSeries 5.3/Windows/.NET - and am extremely new to MQSeries; so please bear with me.
Summary
Q1) How can i extract just the input message from a message sent with a QMFT_XMIT_Q_HEADER?
I can see the message contains but a header followed by real data. I just
want the data (i think)
Q2) Where can i find the documentation that explains what MQMessage
SkipBytes(), DataOffset, and Seek() are used for?
It doesnt matter what programming language - i can find no reference to
these methods/properties on the ibm website.
Q3) How can i generate test messages that contain the MQMFT_XMIT_Q_HEADER ?
I have a created a transmission queue, and am using amqsputc to send
messages - but the messge format remains MQFMT_STRING ! I need to be able to generate messages that contain the MQMFT_XMIT_Q_HEADER in a controlled dev environment.
A little more detail on my problem
I have an application that is expecting the data format of a message to be
MQFMT_STRING, this application is now attempting to connect to a live service (of which i have no control or admistrative capabilities) and is
receiving messages of type MQMFT_XMIT_Q_HEADER.
Using .NET and calling :-
Code: |
MQMessage message = new MQMessage();
queue.Get(message, gmo);
string line = message.ReadString(message.MessageLength); |
I can see the MQMFT_XMIT_Q_HEADER and the data embedded within.
How can i extract just the input message?.
I can see that there is a MQMessage.DataOffset property - but i am
struggling to find any info as to what this relates to or what method within
MQMessage i could use this information for. I can see MQMessage.SkipBytes() and MQMessage.Seek() but again i can find no information on what these methods actually do.
I was hoping that
Code: |
MQMessage message = new MQMessage();
queue.Get(message, gmo);
message.SkipBytes( message.DataOffset )
string line = message.ReadString(message.MessageLength); |
would be sufficient
Is there a guide/document someone could point me at? It doesnt matter what language; C/C++/.NET/VB/JAVA just a reference will do!
Thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 04, 2006 6:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you're getting a message with an MQFT_XMIT_Q_HEADER, then you are doing something wrong.
It is never the job of an application to write messages with this header, nor the job of an application to read messages with this header. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
leehairy |
Posted: Fri Aug 04, 2006 6:31 am Post subject: |
|
|
Novice
Joined: 04 Aug 2006 Posts: 13
|
Thanks for the reply
The message is sent by a live service system. This system is currently configured to send messages to and from the MSoft HIS MSMQ->MQSeries bridge .
The only reason that a transmission queue exists is because the bridge needed it. I have rewritten the client app dropping MSMQ and the bridge, so that it now uses MQ api's to read/write messages.
Temporarily i need to be able to read messages from the original transmission queues. But in my dev env i cannot replicate messages with this header.
Ideally i want to put a temporary fix in my code - something like :-
Code: |
if MQMessage.Format == MQFT_XMIT_Q_HEADER
skip header
read data
else
read data |
Is this a reasonable solution ? or are there side effects i have not considered?
Annoyingly in C this would be a no brainer, i would just add the sizeof(MQFT_XMIT_Q_HEADER) to the message and start reading!
But in .NET im not too sure.
Would |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 04, 2006 6:45 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you have old messages on the transmit queue, use the old way to process them until it's empty.
Otherwise, yes, you should be able to tell the .NET interface to skip the first X bytes of the message data, and start reading after the header. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
leehairy |
Posted: Fri Aug 04, 2006 6:57 am Post subject: |
|
|
Novice
Joined: 04 Aug 2006 Posts: 13
|
Thanks 'jefflowrey'
Quote: |
If you have old messages on the transmit queue, use the old way to process them until it's empty. |
This is the issue - to process these messages means i would have to install MSMQ/Active Directory/MSMQ->MQSeries Bridge and a whole host of patches , fixes and updates.. A world of pain!!!
I have the MQ .NET docs but i cannot see any information on skipping bytes etc!.. Is there a more detailed API guide which details the methods
Thanks for all your help so far |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 04, 2006 7:04 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
leehairy |
Posted: Tue Aug 08, 2006 3:36 am Post subject: |
|
|
Novice
Joined: 04 Aug 2006 Posts: 13
|
Thanks again for the help
Thant last reference to the documentation was exactly what i was looking for.
Much appreciated |
|
Back to top |
|
 |
smtc_pes |
Posted: Thu Nov 24, 2011 10:29 pm Post subject: |
|
|
Newbie
Joined: 24 Nov 2011 Posts: 4
|
Hi,
I am struck with the same problem, but the documentation link provided
seems to be dead link, can you please share the updated link. Thanks in Advance. |
|
Back to top |
|
 |
JasonE |
Posted: Fri Nov 25, 2011 3:55 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
|
Back to top |
|
 |
smtc_pes |
Posted: Mon Nov 28, 2011 3:07 am Post subject: |
|
|
Newbie
Joined: 24 Nov 2011 Posts: 4
|
Thanks for the reply.
but I am still facing issues while reading the data part of the messages with the Format - MQXMIT
Any thoughts would be of much help. Thanks. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Nov 28, 2011 7:47 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You probably shouldn't be reading messages that have the format MQXMIT.
The only messages that will have this format are messages sitting on transmission queues waiting to be processed by channels.
Other than that, since you have provided no description of the issues you're actually having, no further assistance can be provided.
Have you failed to find the documentation on the MQXMIT format?
Have you failed to understand how to parse a fixed-length structure using Java?
Have you failed to properly connect to the queue manager, such that you're not able to read any messages? |
|
Back to top |
|
 |
smtc_pes |
Posted: Tue Nov 29, 2011 3:03 am Post subject: |
|
|
Newbie
Joined: 24 Nov 2011 Posts: 4
|
Thanks for the reply.
I will detail out my requirment, I have messages in the queue which needs to be read out using c#, so I have used the api and I am able to connect to the Queue, The problem comes when I try to pick out the data from the queue which has Format - MQXMIT
I used some browse utilities available on the net and I was able to see the raw data in the MQXMIT tab, which I needed, then I stumbled on this post in the forum, which was exactly what I am looking for
Quote: |
if MQMessage.Format == MQFT_XMIT_Q_HEADER
skip header
read data
else
read data |
I am not sure, how to pick out the data from the queue which has Format - MQXMIT |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 29, 2011 3:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should not be getting messages that have a format of MQXMIT.
The only place messages will exist that have that format is on an XMITQ.
Your application should not be reading messages that are on an XMITQ.
Why are you trying to read messages from an XMITQ?
Otherwise, the XMIT header is a fixed length structure, that is defined by the MQXQH structure. You will read and understand it by writing code that understands how that structure is defined. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 29, 2011 5:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
smtc_pes wrote: |
I have messages in the queue which needs to be read out using c#, so I have used the api and I am able to connect to the Queue, The problem comes when I try to pick out the data from the queue which has Format - MQXMIT |
What queue is this? Specifically what is the queue's USAGE attribute set to?
If the attribute is XMITQ your utility has no business reading messages from it.
If the attribute is NORMAL the putting application has no business putting a MQXMIT header on the front of it. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
smtc_pes |
Posted: Wed Nov 30, 2011 10:05 pm Post subject: |
|
|
Newbie
Joined: 24 Nov 2011 Posts: 4
|
Thanks for the replies.
Currently we have upgraded a very old system, and as part of system validation we need to compare the messages generated by the classical system across the upgraded system.
That's where I am getting this message with the MQXMIT format, now I need to compare the messages across the old and the new system.
so my solution was to read the messages and write them to a flat file, which will then be compared, I was abe to do the same for NORMAL messages, but for MQXMIT messages, I am able to see the data through Quick Watch (VB.NET), but I am not sure how to pull out the data from the object.
Any thoughts on comparing the messages / retrieving the data would be helpful. Thanks |
|
Back to top |
|
 |
|