Author |
Message
|
samsam007 |
Posted: Sun Dec 07, 2008 6:44 pm Post subject: Creating msgexit in runmqsc |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
Hi,
I am trying to create a msgexit on channel with the following command, but failed in the runmqsc QMGR command. I know there is something wrong about it, but I just can't figure that out. Can anyone help out please.
ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) MSGDATA(DEBUG) MSGEXIT(MQCHLCLI)
5 : ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) MSGDATA(DEBUG) MSGEXIT(MQC
HLCLI)
AMQ8405: Syntax error detected at or near end of command segment below:-
ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) MSGDATA
AMQ8427: Valid syntax for the MQSC command:
Thanks |
|
Back to top |
|
 |
samsam007 |
Posted: Sun Dec 07, 2008 8:59 pm Post subject: |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
If I use Receive Exit for this code, it allows me to create the exit.
But is the Receive Exit where I should implement the following C code?
Code: |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cmqc.h>
#include <cmqxc.h>
extern void MQENTRY MsgExit(
PMQCXP pChannelExitParms,
PMQCD pChannelDefinition,
PMQLONG pDataLength,
PMQLONG pAgentBufferLength,
PMQBYTE pAgentBuffer,
PMQLONG pExitBufferLength,
PMQPTR pExitBufferAddr)
{
PMQXQH pXQH
PMQCXP pCXP
PMQCD pCD
FILE *fPtr = NULL
pXQH = (PMQXQH)pAgentBuffer
pCXP = pChannelExitParms
pCD = pChannelDefinition
fPtr = fopen( "c:\myexit1.log", "w")
fprintf(fPtr,"%ld",pChannelDefinition->MsgExitsDefined)
fclose(fPtr)
pCXP->ExitResponse = MQXCC_OK
return
}
|
The runmqsc command:
ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) + RCVEXIT(msgexit('MsgExit'))
When my cliient test application MQwrite writing to the channel from a remote pc, the Receive exit doesnt' get call, because the log file is not created in the directory. Here is the command of MQWrite.class:
java MQWrite.class -h 149.1.2.3 -p 1470 -c TQM3.TCP.CH2 -m QM.MQT3 -q NY.TD.INPUT
Thanks
|
|
Back to top |
|
 |
samsam007 |
Posted: Sun Dec 07, 2008 9:49 pm Post subject: |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
Hi,
I just further test it by executing a MQGET from the client app.
The QM svconn channel now tried to call the msgexit('MsgExit') but got error.
Here is the windows event view error message:
Code: |
User exit not valid.
Channel program 'TQM3.TCP.CH2' ended because user exit 'msgexit('MsgExit')' is not valid.
Ensure that the user exit is specified correctly in the channel definition, and that the user exit program is correct and available.
|
What is the problem with my msgexit.c code?
Your suggestion is highly appreciated.
Thanks |
|
Back to top |
|
 |
xhaxk |
Posted: Sun Dec 07, 2008 11:10 pm Post subject: |
|
|
Apprentice
Joined: 30 Oct 2008 Posts: 31
|
Neither MSGEXIT or MSGDATA is a valid attribute on a SVRCONN channel; these only apply to peer-to-peer channels.
Even if it were correct, the syntax is MSGEXIT('ExitLib(ExitFunction)')
where
ExitLib is the name of the shared library in the standard exits directory, or the full path name.
ExitFunction is the function name inside the lib |
|
Back to top |
|
 |
Michael Dag |
Posted: Mon Dec 08, 2008 12:58 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
when I type
Code: |
DEF CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) MSGDATA(DEBUG) MSGEXIT(MQCHLCLI) |
I get this very nice explanatory response:
Code: |
1 : DEF CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) MSGDATA(DEBUG) MSGEXIT(MQCHL
CLI)
AMQ8405: Syntax error detected at or near end of command segment below:-
def CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) MSGDATA
AMQ8427: Valid syntax for the MQSC command:
DEFINE CHANNEL(channel_name)
CHLTYPE( SVRCONN ) [ DESCR(string) ]
[ HBINT(integer) ] [ KAINT(integer) ]
[ LIKE(channel_name) ] [ MAXMSGL(integer) ]
[ MCAUSER(string) ] [ REPLACE | NOREPLACE ]
[ RCVDATA(string) ] [ RCVEXIT(string) ]
[ SCYDATA(string) ] [ SCYEXIT(string) ]
[ SENDDATA(string) ] [ SENDEXIT(string) ]
[ SSLCAUTH( REQUIRED | OPTIONAL ) ] [ SSLCIPH(string) ]
[ SSLPEER(string) ]
[ TRPTYPE( LU62 | TCP | NETBIOS | SPX ) ]
[ COMPMSG( NONE | RLE | ZLIBFAST | ZLIBHIGH | ANY ) ]
[ COMPHDR( NONE | SYSTEM ) ]
[ MONCHL( QMGR | OFF | LOW | MEDIUM | HIGH ) ] |
You didn't? _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
samsam007 |
Posted: Mon Dec 08, 2008 4:13 pm Post subject: |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
I have changed the msgexit to rcvexit, but use the same C exit code.
Here is what I have executed at the runmqsc command prompt in MQ (v7.0) server:
ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) RCVEXIT('msgexit(MsgExit)')
10 : ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) RCVEXIT('msgexit(MsgExit)'
)
AMQ8016: WebSphere MQ channel changed.
In the remote client windows xp:
D:\MQ Samples>java ExitGetMessage.class NY.TD.INPUT QM.MQT3
Queue name NY.TD.INPUT
Queue manager name QM.MQT3
CALLing mqInit()....
149.1.2.3 --- TQM3.TCP.CH2 --- 1470----sam
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
Error in queue manager connect....
QMGR Name : QM.MQT3
CC : 2
RC : 2009
java.lang.NullPointerException
at ExitGetMessage.mqOpen(ExitGetMessage.java:135)
at ExitGetMessage.getConnected(ExitGetMessage.java:70)
at ExitGetMessage.init(ExitGetMessage.java:44)
at ExitGetMessage.main(ExitGetMessage.java:31)
Looking through the Windows event log in the MQ server, the error said:
User exit not valid.
Channel program 'TQM3.TCP.CH2' ended because user exit 'msgexit(MsgExit)' is not valid.
Ensure that the user exit is specified correctly in the channel definition, and that the user exit program is correct and available.
Here is the exit C code:
Code: |
$ cat msgexit.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cmqc.h>
#include <cmqxc.h>
extern void MQENTRY MsgExit(
PMQCXP pChannelExitParms,
PMQCD pChannelDefinition,
PMQLONG pDataLength,
PMQLONG pAgentBufferLength,
PMQBYTE pAgentBuffer,
PMQLONG pExitBufferLength,
PMQPTR pExitBufferAddr)
{
return;
}
|
Thanks |
|
Back to top |
|
 |
Mr Butcher |
Posted: Mon Dec 08, 2008 11:42 pm Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
where is the executable exit located? _________________ Regards, Butcher |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Dec 09, 2008 2:52 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
samsam007 |
Posted: Tue Dec 09, 2008 3:30 pm Post subject: |
|
|
 Centurion
Joined: 30 Oct 2008 Posts: 107
|
Hi,
Thanks for the reply.
This is how I compile the exit code in the MQ server:
C:\MqExits>cl msgexit.c -o msgexit.c -LD -DEFAULTLIB mqm.lib mqmvx.liB
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be rem
oved in a future release
msgexit.c
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
/out:msgexit.dll
/out:msgexit.c
/dll
/implib:msgexit.lib
msgexit.obj
mqm.lib
mqmvx.liB
C:\MqExits>copy msgexit.dll "c:\Program Files\IBM\WebSphere MQ\exits"\
Overwrite c:\Program Files\IBM\WebSphere MQ\exits\msgexit.dll? (Yes/No/All): yes
1 file(s) copied.
Thanks |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Dec 17, 2008 3:59 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
MQ exit programmer is extremely difficult.
Building an exit in one line on Windows might be possible but I wouldn't do it.
First, you should use an IDE or a makefile to do the build process. Secondly, I always do the build in 3 steps on Windows: compile, create LIB and build DLL.
Finally, have you ever built a DLL for a project that had nothing to do with MQ? If not, I would start with a simple project.
i.e. caller.c
Code: |
#include <stdio.h>
#include <stdlib.h>
#include "mydll.h"
int main(int argc, char **argv)
{
int x;
x = calc (4, 6);
printf("x=%d\n", x);
return 0;
} |
i.e. mydll.h
Code: |
int calc (int, int); |
i.e. mydll.c
Code: |
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "mydll.h"
int calc (int x, int y)
{
int z;
z = x + y;
return (z);
} |
i.e. mydll.def
Code: |
LIBRARY mydll
EXPORTS
calc |
i.e. makefile.nt
Code: |
!include <win32.mak>
all: mydll.dll caller.exe
clean:
del *.bak *.pdb *.obj *.res *.exp *.lib *.dll *.exe
#Compile
mydll.obj: mydll.c mydll.h
$(cc) $(cflags) $(cvarsdll) /MD mydll.c
#Create import library & export file
mydll.lib: mydll.def
lib -machine:i386 -def:mydll.def -out:mydll.lib
#Link
mydll.dll: mydll.obj mydll.lib
$(link) /VERBOSE:LIB /NODEFAULTLIB -out:mydll.dll mydll.exp mydll.obj msvcrt.lib $(conlibs)
# Compile
caller.obj: caller.c mydll.h
$(cc) $(cflags) $(cvars) $*.c
# Build rule for EXE
caller.exe: caller.obj
$(link) $(conlflags) caller.obj mydll.lib $(conlibs) -out:caller.exe |
That's about it for Windows DLL programming 101.
I'll leave it to YOU to figure out how to make this example work with MQ exit programming. If you need more of my help then I will have to start the "billing" clock (i.e. $$$$$$).
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
|