|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MessageExit and segmented messages |
« View previous topic :: View next topic » |
Author |
Message
|
Flibustier |
Posted: Fri Aug 12, 2011 5:10 am Post subject: MessageExit and segmented messages |
|
|
Newbie
Joined: 12 Aug 2011 Posts: 5
|
Hello, we have a problem with message exit and segmented messages. Our message exit is installed on server-channel (server-requester channel pair is used for queue managers communication).
Our message exit is used for logging of transmitted messages MQMD fields. Everything works fine, when messages are not segmented.
When message segmentation is enabled (MQMF_SEGMENTATION_ALLOWED on the client side) and message is transmitted over communication channel by parts (segments), we have a problem: values of such MQMD fields as MsgFlags (MQLONG), Offset (MQLONG), GroupId, MsgSeqNumber are the same for each message segment. But this values must be different for each segment. For example: last transmitted message must have flag MQMF_LAST_SEGMENT.
When we browse transmitted segments in destination queue in WebSphere MQ Explorer, correct field values are shown (different offsets, msgflags, group ids, MsgSecNumber).
Please, help us to find answer for the following question: why MQMD structure which is available from message exit (agentBuffer) does not contain correct field values with segmentation information.
Platform information: Win 2003 Server, WebSphere MQ 7.0.
Thank you for advice!
Best regars |
|
Back to top |
|
 |
RogerLacroix |
Posted: Fri Aug 12, 2011 3:24 pm Post subject: Re: MessageExit and segmented messages |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Flibustier wrote: |
When message segmentation is enabled (MQMF_SEGMENTATION_ALLOWED on the client side) and message is transmitted over communication channel by parts (segments), we have a problem: values of such MQMD fields as MsgFlags (MQLONG), Offset (MQLONG), GroupId, MsgSeqNumber are the same for each message segment. But this values must be different for each segment. For example: last transmitted message must have flag MQMF_LAST_SEGMENT. |
Those fields are only present if the MQMD version field is set to 2. Does your code first check the version number?
Secondly, each message passing through a channel message exit has 2 MQMD headers. Are you looking at the correct one? You should only be dumping out the MQMD that is part of the MQXQH header.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
Flibustier |
Posted: Sun Aug 14, 2011 2:28 am Post subject: Re: MessageExit and segmented messages |
|
|
Newbie
Joined: 12 Aug 2011 Posts: 5
|
RogerLacroix wrote: |
Secondly, each message passing through a channel message exit has 2 MQMD headers. Are you looking at the correct one? You should only be dumping out the MQMD that is part of the MQXQH header.
|
In channel exit declaration we have found only one MQMD Structure - it is a part of agent buffer (pAgentBuffer pointer in the following example).
Code: |
void MQENTRY ChannelExit ( PMQCXP pChannelExitParms,
PMQCD pChannelDefinition,
PMQLONG pDataLength,
PMQLONG pAgentBufferLength,
PMQVOID pAgentBuffer,
PMQLONG pExitBufferLength,
PMQPTR pExitBufferAddr)
{
… Insert code here
} |
Where another instance of MQMD is located in exit arguments? |
|
Back to top |
|
 |
gbaddeley |
Posted: Sun Aug 14, 2011 6:07 pm Post subject: Re: MessageExit and segmented messages |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Flibustier wrote: |
Where another instance of MQMD is located in exit arguments? |
Its also in the AgentBuffer. Look at a hex/char dump of the buffer! _________________ Glenn |
|
Back to top |
|
 |
Flibustier |
Posted: Sun Aug 14, 2011 11:42 pm Post subject: |
|
|
Newbie
Joined: 12 Aug 2011 Posts: 5
|
We have looked at the agent buffer hex/char dump, but only one MQMD structure exists there. If message is segmented, multiple structures ara available from dump, but types and offsets of this structures are unknown.
The version of our MQMD structure that is submitted to message exit is 1.
Application, that puts message to a queue (with mqput call) assigns value 2 to Version field of MQMD structure.
Can you, please, provide us with advices:
1. What is the correct way to obtain correct MQMD structure from agentBuffer?
2. How can we change MQMD version to 2?
Thanks in advice. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Aug 15, 2011 3:13 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Flibustier wrote: |
The version of our MQMD structure that is submitted to message exit is 1. |
You are looking at the wrong field or the wrong message.
As I already mentioned, you should only be dumping out the MQMD that is part of the MQXQH header.
It is time for you to post some code (and use the code keyword).
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
Flibustier |
Posted: Mon Aug 15, 2011 8:42 pm Post subject: |
|
|
Newbie
Joined: 12 Aug 2011 Posts: 5
|
RogerLacroix wrote: |
It is time for you to post some code (and use the code keyword).
|
Here is a part of our code, that obtains MQMD Structure from agent buffer:
Code: |
extern "C" __declspec(dllexport) void MQENTRY ChannelExit ( PMQCXP pChannelExitParms, PMQCD pChannelDefinition, PMQLONG pDataLength, PMQLONG pAgentBufferLength, PMQVOID pAgentBuffer, PMQLONG pExitBufferLength, PMQPTR pExitBufferAddr )
{
MQXQH* pMQXQH = (MQXQH*)pAgentBuffer;
MQMD2* pMQMD = (MQMD2*)&pMQXQH->MsgDesc;
…
}
|
As we can see in the source above, we cast pAgentBuffer pointer to MQXQH pointer, and then we cast MsgDesc field of MQXQH structure to MQMD2 structure.
What's wrong there? |
|
Back to top |
|
 |
gbaddeley |
Posted: Mon Aug 15, 2011 10:15 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Flibustier wrote: |
Here is a part of our code, that obtains MQMD Structure from agent buffer:
Code: |
extern "C" __declspec(dllexport) void MQENTRY ChannelExit ( PMQCXP pChannelExitParms, PMQCD pChannelDefinition, PMQLONG pDataLength, PMQLONG pAgentBufferLength, PMQVOID pAgentBuffer, PMQLONG pExitBufferLength, PMQPTR pExitBufferAddr )
{
MQXQH* pMQXQH = (MQXQH*)pAgentBuffer;
MQMD2* pMQMD = (MQMD2*)&pMQXQH->MsgDesc;
…
}
|
As we can see in the source above, we cast pAgentBuffer pointer to MQXQH pointer, and then we cast MsgDesc field of MQXQH structure to MQMD2 structure.
What's wrong there? |
Do you test pChannelExitParms->ExitReason == MQXR_MSG ?
Do you test that pMQXQH is actually pointing to a MQXQH structure, before trying to use any of the fields in it? (StrucId) _________________ Glenn |
|
Back to top |
|
 |
Flibustier |
Posted: Mon Aug 15, 2011 11:18 pm Post subject: |
|
|
Newbie
Joined: 12 Aug 2011 Posts: 5
|
This is a condition for our message exit
Code: |
if(pChannelExitParms->ExitReason == MQXR_MSG)
{
//.. log MQMD structure fields here
}
|
The value of pMQXQH->StrucId = 'XQH'; |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Aug 17, 2011 1:33 am Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Flibustier wrote: |
This is a condition for our message exit
Code: |
if(pChannelExitParms->ExitReason == MQXR_MSG)
{
//.. log MQMD structure fields here
}
|
The value of pMQXQH->StrucId = 'XQH'; |
OK, you seem to be on the right track with coding a channel message exit. The format and usage of the agentbuffer is not fully documented by IBM, so you are pretty much on your own with figuring out how MQMD v2 and segmented messages are transmitted. Hint: MQMDE _________________ Glenn |
|
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
|
|
|
|