|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Api Exit Programming - please help/suggest |
« View previous topic :: View next topic » |
Author |
Message
|
TKiranKumar |
Posted: Thu May 27, 2004 1:01 am Post subject: Api Exit Programming - please help/suggest |
|
|
Novice
Joined: 14 May 2004 Posts: 15
|
Hi All,
I am writing an API Exit that Encrypts - user data when an Application puts an ASCII message on the queue.
Since the requirement is to perform encyption and decryption on the QUEUE level (not link level ) , I hope API Exits are the solution.
Therefore for Encryption, this conversion code should be present in
MQ_PUT_EXIT PutBefore;
The parameters are
void MQENTRY PutBefore ( PMQAXP pExitParms
, PMQAXC pExitContext
, PMQHCONN pHconn
, PMQHOBJ pHobj
, PPMQMD ppMsgDesc
, PPMQPMO ppPutMsgOpts
, PMQLONG pBufferLength
, PPMQVOID ppBuffer
, PMQLONG pCompCode
, PMQLONG pReason
)
The data to be converted lies in ppBuffer and its corresponding length in pBufferLength. (Both of them Input\output fields)
Question 1: Are these the ONLY parameters to manipulate (for the application i am writing)? If not what paramaters do I manipulate..
Now, in my code if i even try manipulating the ppBuffer(even by a character) , the Queuemanager does not start.
For Ex:
{
...
char **cpptr =(char **)ppBuffer;
...
(*cpptr)[h] = 'K';
..
}
If i remove the code where I manipulate the buffer, the QMGR starts.
What I have (probably )understood from this behaviour is that MQPUT is being called as soon as the QMGR starts (with junk data) even before an actual message is being put on the Queue .
Unable to manipulate the junk buffer(using the code snippet above) after the API exit call, the QMGR does not start.
Question 2: What parameter(in the function call above) would inform the MQPUT function that a User Message has been PUT on to the Queue.
If anybody could provide a code snippet/example whereby the buffer is being manipualted thru the Api exit (from what was actually being put on the queue) , it would be grateful..
Thanks and Regards,
Kiran |
|
Back to top |
|
 |
clindsey |
Posted: Thu May 27, 2004 5:27 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Kiran,
Some MQ internal functions will invoke the exit. You probably do not want to register the exit points for internal functions, APICallerType == MQXACT_INTERNAL. You can do this:
Code: |
if (pExitParms->APICallerType == MQXACT_INTERNAL)
{
rc = MQXCC_SKIP_FUNCTION;
}
|
in the routine where the functions are registered to avoid processing for internal functions. The downside to this, is that the listener also would not call the exits so it would not call your exit in the case of remote puts. You may have to refine the filtering by looking also at ApplName in the API Exit Context (MQAXC structure).
Charlie |
|
Back to top |
|
 |
TKiranKumar |
Posted: Thu May 27, 2004 10:49 pm Post subject: Issue Solved |
|
|
Novice
Joined: 14 May 2004 Posts: 15
|
Hi Charlie,
Thanks a lot for that suggestion . After Trapping the
pExitContext->ApplName , it ALL Works.
Thanks a Million again - Beautiful suggestion.
Regards,
Kiran |
|
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
|
|
|
|