ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » User Exits » MessageExit and segmented messages

Post new topic  Reply to topic
 MessageExit and segmented messages « View previous topic :: View next topic » 
Author Message
Flibustier
PostPosted: Fri Aug 12, 2011 5:10 am    Post subject: MessageExit and segmented messages Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Fri Aug 12, 2011 3:24 pm    Post subject: Re: MessageExit and segmented messages Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
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
View user's profile Send private message Visit poster's website
Flibustier
PostPosted: Sun Aug 14, 2011 2:28 am    Post subject: Re: MessageExit and segmented messages Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Sun Aug 14, 2011 6:07 pm    Post subject: Re: MessageExit and segmented messages Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
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
View user's profile Send private message
Flibustier
PostPosted: Sun Aug 14, 2011 11:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Mon Aug 15, 2011 3:13 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
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
View user's profile Send private message Visit poster's website
Flibustier
PostPosted: Mon Aug 15, 2011 8:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Mon Aug 15, 2011 10:15 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
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
View user's profile Send private message
Flibustier
PostPosted: Mon Aug 15, 2011 11:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Wed Aug 17, 2011 1:33 am    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » User Exits » MessageExit and segmented messages
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.