MQ message - Websphere
This is a discussion on MQ message - Websphere ; Hi,
Does anyone knows whether Websphere MQ only accept the message format that is defined in the Application Programming Guide? i.e.:
i am thinking of using MQ to receive "messages" from some legacy system but those messages are not specified ...
-
MQ message
Hi,
Does anyone knows whether Websphere MQ only accept the message format that is defined in the Application Programming Guide? i.e.:
<--- MQMD ----><--- Application Data --->
i am thinking of using MQ to receive "messages" from some legacy system but those messages are not specified in the MQ message format.
Thanks.
-
Re: MQ message
The app must supply two pointers to MQGET and MQPUT - one for the MD, one
for the message body. The two are therefore separate entities in the
program you write, but MQ will (in the case of MQPUT) generally put them
together within the library code loaded in your program, and forward them to
the queue manager and (in the case of MQGET) similarly will copy them into
the two buffers you supply.
In summary, your app data goes in the "Application Data" buffer passed to
MQPUT on the source system, and the same binary data will be delivered to
MQGET on your target system.
Martin
"a Ken" wrote in message
news:778779789.1133923700560.JavaMail.wassrvr@ltsg was007.sby.ibm.com...
> Hi,
>
> Does anyone knows whether Websphere MQ only accept the message format that
> is defined in the Application Programming Guide? i.e.:
>
> <--- MQMD ----><--- Application Data --->
>
> i am thinking of using MQ to receive "messages" from some legacy system
> but those messages are not specified in the MQ message format.
>
> Thanks.
-
Re: MQ message
Hi,
Thanks for your reply.
If i get you correctly, each MQGET and MQPUT has 2 buffers. One of buffers is used for the MD and the other is used for the application data.
So does that mean that even when the "message" is non-compliance with the MD format specified, MQGET and MQPUT is still able to process those messages? If the message is without a MD, is it still possible to use MQGET to retrieve the message?
regards
-
Re: MQ message
> If i get you correctly, each MQGET and MQPUT has 2 buffers. One of buffers
> is used for the MD and the other is used for the application data.
Yes. The app allocates the buffers and passes pointers into the MQI. Do I
understand correctly that you are using the MQI (from C?).
> So does that mean that even when the "message" is non-compliance with the
> MD format specified, MQGET and MQPUT is still able to process those
> messages? If the message is without a MD, is it still possible to use
> MQGET to retrieve the message?
It is always necessary to supply an MD when calling MQPUT. But this is
metadata for the message. It doesn't constitute a part of the message user
data.
When calling MQGET, you will get the message user data (into one buffer
supplied by the app) and the MD (into the other buffer supplied by the app).
It will always be possible for the program to ignore the contents of the MD,
if this is what the programmer wants - but it's there in case it is needed.
Just to clarify: the MD and the message user data are separate as far as the
API is concerned. The MD is metadata, the message user data is the data.
They are supplied separately to the API, but the MQ API library code
internally may choose to concatenate them together when communicating with
the queue manager, when necessary.
Therefore I think it's not possible for any message user data to be
non-compliant with an MQ "standard format" - because there is no standard
format. MQ preserves the precise binary format of the message user data
from machine to machine. The MD flows as metadata, and indeed is
transformed, as necessary, into native integer encodings and text codepage,
to allow simple reading on the machine where it is retrieved with MQGET.
I hope this helps
Regards,
Martin
-
Re: MQ message
Hi Martin,
Yes i am using it with C/C++. Right, i think i get what you meant.
I doesn't matter whether my message has any MD or not. If there is, it will go to the buffer that handles it and the rules will be applied accordingly.
Thanks a lot
Lacon
-
Re: MQ message
Hi Martin, all
Since header and data buffer are separate... then is it possible only to get the header part from the Queue.
This is needed in scenarios where we want to consume header information only from big messages.... where downloading messages takes good amount of time....
-
Re: MQ message
i am thinking of using MQ to receive "messages" from some legacy system but those messages are not specified in the MQ message format.
Conceptually, MQ does not have a fixed message format. The "data" portion of the MQ message can be whatever you like. It can be a direct copy of the message from the legacy system. The "message descriptor" portion of the MQ message has a few fields which may need to be filled out by the putting application, but the default MD values are usually sufficient. If the message data is printable characters, you may want to allow MQ to do automatic character set conversion (if you need to cross different platforms, eg ASCII to EBCDIC) by setting the Format field to MQFMT_STRING.
The legacy messages will still need to be put into MQ by a program, using the appropriate MQ methods (eg MQPUT call). You can't directly 'load' the legacy messages into the internals of MQ, there needs to be a 'bridging' program which puts them in a MQ 'queue'.
HTH, Glenn.