|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Message Exit not being modified by CHAD exit |
« View previous topic :: View next topic » |
Author |
Message
|
cj930736 |
Posted: Fri Aug 23, 2013 12:44 am Post subject: Message Exit not being modified by CHAD exit |
|
|
Newbie
Joined: 23 Aug 2013 Posts: 3
|
Hi All,
I have written a channel exit in C and the part of it which deals with manually overriding the MsgExit parameter is as follows:-
typedef struct USEREXIT
{
char ExitName[MQ_EXIT_NAME_LENGTH];
} USEREXIT, *PUSEREXIT;
typedef struct USERDATA
{
char ExitData[MQ_EXIT_DATA_LENGTH];
} USERDATA, *PUSERDATA;
USEREXIT userexit[3];
USERDATA userdata[3];
case MQXT_CHANNEL_AUTO_DEF_EXIT :
if (pChannelExitParms->ExitReason==MQXR_AUTO_CLUSSDR)
{
strncpy(userexit[0].ExitName,exitvalue,20);
memset(userdata[0].ExitData,' ',MQ_EXIT_DATA_LENGTH);
pChannelDefinition->MsgExitsDefined = 1;
pChannelDefinition->MsgExitPtr = (char *)userexit[0].ExitName;
pChannelDefinition->MsgUserDataPtr = (char *)userdata[0].ExitData;
memset(userdata[1].ExitData,' ',MQ_EXIT_DATA_LENGTH);
pChannelDefinition->ReceiveExitsDefined = 0;
pChannelDefinition->ReceiveExitPtr = NULL;
pChannelDefinition->ReceiveUserDataPtr = (char *)userdata[1].ExitData;
memset(userdata[2].ExitData,' ',MQ_EXIT_DATA_LENGTH);
pChannelDefinition->SendExitsDefined = 0;
pChannelDefinition->SendExitPtr = NULL;
pChannelDefinition->SendUserDataPtr = (char *)userdata[2].ExitData;
pChannelExitParms->ExitResponse = MQXCC_OK;
fprintf(hLdebug, "(1)MsgExitsPtr has the value: %s\n", pChannelDefinition -> MsgExitPtr );
}
Now, the code is working to the extent that MsgExitPtr conatains the value "msglogger(msglogger)" but the message exit branch of the switch statement doesn't appear to be being invoked when a message is put through the channel.
To give the issue some context, I have several queue managers in a cluster, some on Unix and some on Mainframe. When the cluster sender channel on a UNIX queue manager is auto defined based on a CLUSRCVR channel on a mainframe, the MsgExit parameter will be blank and I need to populate it with "msglogger(msglogger)".
Any help on this would be much appreciated...
Chris. |
|
Back to top |
|
 |
gbaddeley |
Posted: Sun Aug 25, 2013 4:37 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
USEREXIT userexit[3];
USERDATA userdata[3];
Where do you allocate memory for this data? It needs to be in a persistent location that MQ internal code can access over the life of the channel instance. _________________ Glenn |
|
Back to top |
|
 |
cj930736 |
Posted: Mon Aug 26, 2013 11:28 pm Post subject: |
|
|
Newbie
Joined: 23 Aug 2013 Posts: 3
|
Hi,
Thanks for the response. Sof I use the malloc command to allocate memory for userdata and userexit, this should work?
Chris. |
|
Back to top |
|
 |
cj930736 |
Posted: Tue Aug 27, 2013 12:20 am Post subject: |
|
|
Newbie
Joined: 23 Aug 2013 Posts: 3
|
Does anyone have an example of a channel auto definition exit (written in C), I could have a look at?
Chris |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Aug 27, 2013 3:54 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Go to google. Search for 'mq chad exit sample'. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
gbaddeley |
Posted: Tue Aug 27, 2013 3:07 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
cj930736 wrote: |
Hi,
Thanks for the response. Sof I use the malloc command to allocate memory for userdata and userexit, this should work?
Chris. |
malloc() can be used in MQ exits, but make sure you store the pointer in a safe place, and call free() when the channel instance terminates.
Always test pointers for non-null values before using them. _________________ Glenn |
|
Back to top |
|
 |
JenniferBroodman |
Posted: Thu Aug 29, 2013 8:45 pm Post subject: |
|
|
Newbie
Joined: 29 Aug 2013 Posts: 2
|
Great Thanks for the reply..... |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Sep 03, 2013 10:20 am Post subject: Re: Message Exit not being modified by CHAD exit |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
cj930736 wrote: |
Now, the code is working to the extent that MsgExitPtr conatains the value "msglogger(msglogger)" but the message exit branch of the switch statement doesn't appear to be being invoked when a message is put through the channel. |
That's because you are using the "Ptr" variables incorrectly. Somewhere around here, I posted a thing on exit programming requiring expert knowledge of both MQ and C programming.
Can I ask you how much time you have spent on creating a CHAD exit?
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
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
|
|
|
|