|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Dealing with fields in MQMD |
« View previous topic :: View next topic » |
Author |
Message
|
samsam007 |
Posted: Tue Dec 16, 2008 9:51 pm Post subject: Dealing with fields in MQMD |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
I want to use a receive exit code at MQ server side to extract the ApplIdentityData field from the MQMD structure.
I have read through some code in the supportPac, it seems that I need to implement a MQStart() function in C.
Eg.
void MQENTRY MQStart(
PMQDXP pDataConvExitParms, /* Data-conversion exit parameter */
/* block */
PMQMD pMsgDesc, /* Message descriptor */
MQLONG InBufferLength, /* Length in bytes of InBuffer */
PMQVOID pInBuffer, /* Buffer containing the unconverted */
/* message */
MQLONG OutBufferLength, /* Length in bytes of OutBuffer */
PMQVOID pOutBuffer) /* Buffer containing the converted */
/* message */
{
MQLONG ReturnCode = MQRC_NONE;
MQHCONN hConn = pDataConvExitParms->Hconn;
MQLONG opts = pDataConvExitParms->AppOptions;
PMQBYTE in_cursor = (PMQBYTE)pInBuffer;
PMQBYTE out_cursor = (PMQBYTE)pOutBuffer;
PMQBYTE in_lastbyte = (PMQBYTE)pInBuffer + InBufferLength - 1;
PMQBYTE out_lastbyte = (PMQBYTE)pOutBuffer + OutBufferLength - 1;
MQLONG MsgEncoding = pMsgDesc->Encoding;
MQLONG ReqEncoding = pDataConvExitParms->Encoding;
MQLONG MsgCCSID = pMsgDesc->CodedCharSetId;
MQLONG ReqCCSID = pDataConvExitParms->CodedCharSetId;
MQLONG CompCode = pDataConvExitParms->CompCode;
MQLONG Reason = pDataConvExitParms->Reason;
...
But in some exit code, the numbers of parameters that pass into the MQStart is different. The BlockIP2.c program have an empty MQStart() function, eg. MQStart(void) {;}
This confused me.
Can anyone clarify how to write to and read from the MQMD fields?
Thanks |
|
Back to top |
|
 |
xhaxk |
Posted: Tue Dec 16, 2008 10:08 pm Post subject: |
|
|
Apprentice
Joined: 30 Oct 2008 Posts: 31
|
MQStart is a dummy entry point that WMQ searches for in any exit lib. You should not put code in the function.
Your own exit function should be exported using the facilities for the platform you are writing for.
A RCV exit is presented with a bit stream of the data that arrived over the socket. This data may or may not contain an MQMD; if you think it might, then you can look for the "MD " eyecatcher, and process the data following that as an MQMD at your own risk. Note that many data flows over a channel do not contain an MQMD. The channel data flow type, byte 10, has many values, only some of which have been published by IBM - see the Intercomms manual.
A MSG exit is presented with the MQMD, so that would be the best place to do any manipulation of the MD data.
Exits are an advanced topic, see Roger Lacroix's many posts on the subject. |
|
Back to top |
|
 |
samsam007 |
Posted: Tue Dec 16, 2008 10:17 pm Post subject: |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
Thank you for the clarification.
xhaxk wrote: |
MQStart is a dummy entry point that WMQ searches for in any exit lib. You should not put code in the function.
Your own exit function should be exported using the facilities for the platform you are writing for.
A RCV exit is presented with a bit stream of the data that arrived over the socket. This data may or may not contain an MQMD; if you think it might, then you can look for the "MD " eyecatcher, and process the data following that as an MQMD at your own risk. Note that many data flows over a channel do not contain an MQMD. The channel data flow type, byte 10, has many values, only some of which have been published by IBM - see the Intercomms manual.
A MSG exit is presented with the MQMD, so that would be the best place to do any manipulation of the MD data.
Exits are an advanced topic, see Roger Lacroix's many posts on the subject. |
My design architecture of this MQ application is using a svrconn channel only. So I can't use MsgExit on this connection channel.
For svrconn channel, is there any way I can set and get some of the fields from MQMD?
Thanks |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Dec 17, 2008 4:33 pm Post subject: Re: Dealing with fields in MQMD |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
samsam007 wrote: |
I want to use a receive exit code at MQ server side to extract the ApplIdentityData field from the MQMD structure.
...
Can anyone clarify how to write to and read from the MQMD fields? |
You don't appear to have a basic understanding of MQ.
You need to do some serious reading on MQMD context fields. Some MQMD fields are freely available where as other MQMD fields belong to either Origin Context or Identity Context. And ApplIdentityData belongs to Identity Context.
Therefore, you cannot simply modify the field in the receive exit.
How would you update the ApplIdentityData field from a standard C program. You cannot simply do:
Code: |
strncpy(md.ApplIdentityData, "something" sizeof(md.ApplIdentityData)); |
You need to specify MQOO_SET_IDENTITY_CONTEXT on the MQOPEN API call and you need to specify MQPMO_SET_IDENTITY_CONTEXT on the MQPUT API call.
Therefore, in an exit you MUST do exactly the same!!!!!!! There are no short-cuts.
I have built exits that do exactly what you are trying to do and, from personal experience, I know you are in for a world of hurt. This is EXTREMELY complex.
A while ago, I even posted a message if anybody wanted a commercial product to modify certain MQMD from an exit (I built both native "C" and Java exits). There was very little interest, so I put it on the shelf.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
samsam007 |
Posted: Wed Dec 17, 2008 7:34 pm Post subject: Re: Dealing with fields in MQMD |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
[code]
Some MQMD fields are freely available where as other MQMD fields belong to either Origin Context or Identity Context. And ApplIdentityData belongs to Identity Context.
Therefore, you cannot simply modify the field in the receive exit.
How would you update the ApplIdentityData field from a standard C program. You cannot simply do:
[code]strncpy(md.ApplIdentityData, "something" sizeof(md.ApplIdentityData));[/code]
You need to specify MQOO_SET_IDENTITY_CONTEXT on the MQOPEN API call and you need to specify MQPMO_SET_IDENTITY_CONTEXT on the MQPUT API call.
Therefore, in an exit you MUST do exactly the same!!!!!!! There are no short-cuts.
Regards,
Roger Lacroix
Capitalware Inc.[/quote]
Thank you for the clarification.
Can you show me few lines of codes how to modify this field in a C exit code, by using the following MQentry function:
[code]
extern void MQENTRY ReceiveMessageExit (PMQVOID channelExitParms,
PMQVOID channelDef,
PMQLONG dataLength,
PMQLONG agBufLength,
PMQVOID agBuf,
PMQLONG exitBufLength, PMQPTR exitBufAddr)
{
....
[/code]
Thanks |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Dec 17, 2008 8:36 pm Post subject: Re: Dealing with fields in MQMD |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
samsam007 wrote: |
Can you show me few lines of codes how to modify this field in a C exit code, by using the following MQentry function: |
A few lines of code is meaningless out of context.
I have a wife and 5 kids and our 2 pugs mated and now we have 5 more pugs. I have house & car payments. So, you take care of my money issues for a month and I'll give you the code for free.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 18, 2008 1:10 am Post subject: Re: Dealing with fields in MQMD |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
RogerLacroix wrote: |
our 2 pugs mated and now we have 5 more pugs. |
Congratulations.
by a mile, but congratulations. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
samsam007 |
Posted: Thu Dec 18, 2008 2:58 pm Post subject: Re: Dealing with fields in MQMD |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
RogerLacroix wrote: |
samsam007 wrote: |
I want to use a receive exit code at MQ server side to extract the ApplIdentityData field from the MQMD structure.
...
Can anyone clarify how to write to and read from the MQMD fields? |
You don't appear to have a basic understanding of MQ.
You need to do some serious reading on MQMD context fields. Some MQMD fields are freely available where as other MQMD fields belong to either Origin Context or Identity Context. And ApplIdentityData belongs to Identity Context.
Therefore, you cannot simply modify the field in the receive exit.
How would you update the ApplIdentityData field from a standard C program. You cannot simply do:
Code: |
strncpy(md.ApplIdentityData, "something" sizeof(md.ApplIdentityData)); |
You need to specify MQOO_SET_IDENTITY_CONTEXT on the MQOPEN API call and you need to specify MQPMO_SET_IDENTITY_CONTEXT on the MQPUT API call.
Therefore, in an exit you MUST do exactly the same!!!!!!! There are no short-cuts.
I have built exits that do exactly what you are trying to do and, from personal experience, I know you are in for a world of hurt. This is EXTREMELY complex.
A while ago, I even posted a message if anybody wanted a commercial product to modify certain MQMD from an exit (I built both native "C" and Java exits). There was very little interest, so I put it on the shelf.
Regards,
Roger Lacroix
Capitalware Inc. |
Roger,
IF I don't have basic understanding of the product, how would I know I can't use msgexit on svrconn? how would I know I can code security channel exit? Your comment is too offensive in the public.
You don't have a professional attitude at all. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Dec 19, 2008 12:48 am Post subject: Re: Dealing with fields in MQMD |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
samsam007 wrote: |
You don't have a professional attitude at all. |
And you're asking us to do a task most of us would charge for.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|