Featured post
MQMessage exploring (using WebSphere MQ .NET API) -
i'm newbie websphere mq, have 1 question regarding mqmessage api. seems receiver of mqmessage should know in advance:
it make no sense me. since if i'm not familiar message structure should explore options until retrieve data in it?
help appreciated, guy
yes, absolutely correct if message structured data such fixed-length record format, must know in advance format of message in order parse it. on other hand, if message payload tagged data structure (such valid xml) use normal parsing access it. example, might use xpath access xml payload without first knowing exact structure.
the methods mention (writeint, readint, etc.) ordinarily used extract data known format , advance buffer pointer next field. however, there methods read , write utf strings. if reason application must process variety of message types, can inquire on message format , message type querying message descriptor. method doing documented in message descriptor fields properties. in way can distinguish between different types , formats of message , parse them appropriately.
note docs have linked above v7 .net classes. since v6 end-of-life september 2011, hoped new development v7 classes, , preferably connecting v7 qmgr.
edit - response comments
example of checking message format:
per page linked above, check c header file cmqc.h fields in mqmd. tell field name field type. in default windows installation, file lives @ c:\program files\ibm\websphere mq\tools\c\include\cmqc.h
so example, message.getstringproperty('root.mqmd.format')
returns message format. near top of cmqc.h find list of macros named mqfmt_ possible values mqmd format field. of v7.01 this:
/* formats */ #define mqfmt_none " " #define mqfmt_admin "mqadmin " #define mqfmt_channel_completed "mqchcom " #define mqfmt_cics "mqcics " #define mqfmt_command_1 "mqcmd1 " #define mqfmt_command_2 "mqcmd2 " #define mqfmt_dead_letter_header "mqdead " #define mqfmt_dist_header "mqhdist " #define mqfmt_embedded_pcf "mqhepcf " #define mqfmt_event "mqevent " #define mqfmt_ims "mqims " #define mqfmt_ims_var_string "mqimsvs " #define mqfmt_md_extension "mqhmde " #define mqfmt_pcf "mqpcf " #define mqfmt_ref_msg_header "mqhref " #define mqfmt_rf_header "mqhrf " #define mqfmt_rf_header_1 "mqhrf " #define mqfmt_rf_header_2 "mqhrf2 " #define mqfmt_string "mqstr " #define mqfmt_trigger "mqtrig " #define mqfmt_work_info_header "mqhwih " #define mqfmt_xmit_q_header "mqxmit "
the actual mqmd structure defined near bottom of cmqc.h. of v7.0.1 looks this:
/****************************************************************/ /* mqmd2 structure -- version-2 message descriptor */ /****************************************************************/ typedef struct tagmqmd2 mqmd2; typedef mqmd2 mqpointer pmqmd2; struct tagmqmd2 { mqchar4 strucid; /* structure identifier */ mqlong version; /* structure version number */ mqlong report; /* report options */ mqlong msgtype; /* message type */ mqlong expiry; /* expiry time */ mqlong feedback; /* feedback or reason code */ mqlong encoding; /* numeric encoding of message data */ mqlong codedcharsetid; /* character set identifier of message data */ mqchar8 format; /* format name of message data */ mqlong priority; /* message priority */ mqlong persistence; /* message persistence */ mqbyte24 msgid; /* message identifier */ mqbyte24 correlid; /* correlation identifier */ mqlong backoutcount; /* backout counter */ mqchar48 replytoq; /* name of reply-to queue */ mqchar48 replytoqmgr; /* name of reply queue manager */ mqchar12 useridentifier; /* user identifier */ mqbyte32 accountingtoken; /* accounting token */ mqchar32 applidentitydata; /* application data relating identity */ mqlong putappltype; /* type of application put message */ mqchar28 putapplname; /* name of application put message */ mqchar8 putdate; /* date when message put */ mqchar8 puttime; /* time when message put */ mqchar4 applorigindata; /* application data relating origin */ mqbyte24 groupid; /* group identifier */ mqlong msgseqnumber; /* sequence number of logical message within group */ mqlong offset; /* offset of data in physical message start of logical message */ mqlong msgflags; /* message flags */ mqlong originallength; /* length of original message */ };
the cmqc.h file defines macros each of fields shown , these contain possible values. these macros defined in .net classes mqc object. mqc is described here since has no methods, page refers list of wmq constants defines. page is here.
- Get link
- X
- Other Apps
Comments
Post a Comment