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 » General IBM MQ Support » Message Exit not being modified by CHAD exit

Post new topic  Reply to topic
 Message Exit not being modified by CHAD exit « View previous topic :: View next topic » 
Author Message
cj930736
PostPosted: Fri Aug 23, 2013 12:44 am    Post subject: Message Exit not being modified by CHAD exit Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Sun Aug 25, 2013 4:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
cj930736
PostPosted: Mon Aug 26, 2013 11:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
cj930736
PostPosted: Tue Aug 27, 2013 12:20 am    Post subject: Reply with quote

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
View user's profile Send private message
bruce2359
PostPosted: Tue Aug 27, 2013 3:54 am    Post subject: Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Tue Aug 27, 2013 3:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
JenniferBroodman
PostPosted: Thu Aug 29, 2013 8:45 pm    Post subject: Reply with quote

Newbie

Joined: 29 Aug 2013
Posts: 2

Great Thanks for the reply.....
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Sep 03, 2013 10:20 am    Post subject: Re: Message Exit not being modified by CHAD exit Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Message Exit not being modified by CHAD exit
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.