Author |
Message
|
romudd |
Posted: Fri Aug 27, 2004 7:57 am Post subject: Message exit sample code |
|
|
Apprentice
Joined: 12 Aug 2003 Posts: 31 Location: Sao Paulo - Brazil
|
Hello,
I need a message exit program to change the userid of incoming messages, could you help me indicating how I can find a sample code for doing this? If possible, I would also appreciate some information on how to compite it (the gcc options, libraries required, etc).
I'm an administrator so I don't have enough skills to write the whole code for a channel exit , but if I have an example I will try to have it to work.
oh I almost Forgot, I'm running MQseries 2.3 on Linux
thanks! |
|
Back to top |
|
 |
vennela |
Posted: Fri Aug 27, 2004 9:41 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Have you seen the support pac MA06: MQSeries sample message exit to record transmitted messages
Maybe that's where you should start |
|
Back to top |
|
 |
romudd |
Posted: Mon Sep 06, 2004 3:51 am Post subject: |
|
|
Apprentice
Joined: 12 Aug 2003 Posts: 31 Location: Sao Paulo - Brazil
|
Thanks for your reply!
Now I'm trying to recompile it to test some changes, but it's not working... I've found (in the documents and at the forum) some information on how to compile it on various operating systems, but not in Linux... can someone help me to compile the exit with gcc?
That's what I'm trying:
gcc -c MSGMON.c
gcc -shared -o libmsgmon.so MSGMON.o
It creates a shared library, but when trying to activate the channel I get the error:
Quote: |
AMQ6175: The system could not dynamically load the library
/var/mqm/exits/libmsgmon.so. The error message was . The queue manager will
continue without this module. |
|
|
Back to top |
|
 |
clindsey |
Posted: Mon Sep 06, 2004 9:46 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Try using:
gcc -c -fPIC MSGMON.c
gcc -shared -Wl,-soname,libmsgmon.so -o libmsgmon.so
Charlie |
|
Back to top |
|
 |
romudd |
Posted: Mon Sep 06, 2004 11:39 am Post subject: |
|
|
Apprentice
Joined: 12 Aug 2003 Posts: 31 Location: Sao Paulo - Brazil
|
The compilation was ok, but I still have the same error  |
|
Back to top |
|
 |
clindsey |
Posted: Tue Sep 07, 2004 5:51 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Make sure user mqm has priviliges to read and execute this lib.
If you can su to user mqm, run 'ldd libmsgmon.so'. This should tell you if mqm can load the library and any dependent libraries.
Charlie |
|
Back to top |
|
 |
romudd |
Posted: Wed Sep 08, 2004 2:04 am Post subject: |
|
|
Apprentice
Joined: 12 Aug 2003 Posts: 31 Location: Sao Paulo - Brazil
|
the test with ldd was ok, I can see all the dependencies:
> ldd /var/mqm/exits/libmsgmon.so
____libc.so.6 => /lib/libc.so.6 (0x40014000)
____/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
> ldd /lib/libc.so.6
____/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> ldd /lib/ld-linux.so.2
____statically linked
I have also tried the nm to list the symbols exported from the library. The function MsgExit was not available, is it normal? |
|
Back to top |
|
 |
clindsey |
Posted: Wed Sep 08, 2004 2:31 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
nm libmsgmon.so | grep MsgExit
should display MsgExit and its address.
Also the MSGEXIT parm in the channel def must also include the entry point name,
MSGEXIT(/var/mqm/exits/libmsgmon.so(MsgExit))
To define it, put single quote marks around it.
msgexit('/var/mqm/exits/libmsgmon.so(MsgExit)').
You may have to run an mqtrace to get the real return code from the os about why the exit doesn't load.
Charlie |
|
Back to top |
|
 |
romudd |
Posted: Thu Sep 09, 2004 11:19 am Post subject: |
|
|
Apprentice
Joined: 12 Aug 2003 Posts: 31 Location: Sao Paulo - Brazil
|
Hi,
nm libmsgmon.so | grep MsgExit didn't show the correct entry. I made a change in the second gcc command, adding the object file name:
gcc -c -fPIC MSGMON.c
gcc -shared -Wl,-soname,libmsgmon.so -o libmsgmon.so MSGMON.o
The nm output then seems correct:
$ nm /var/mqm/exits/libmsgmon.so | grep MQStart
00000c34 T MQStart
$ nm /var/mqm/exits/libmsgmon.so | grep MsgExit
00000c3a T MsgExit
This is the channel's MSGEXIT properties:
AMQ8414: Display Channel details.
MSGEXIT(/var/mqm/exits/libmsgmon.so(MsgExit))
MSGDATA( )
The configuration was made using the single quotes.
But the channel cannot start yet:
AMQ6175: The system could not dynamically load the library
/var/mqm/exits/libmsgmon.so. The error message was . The queue manager will
continue without this module.
As you said, I enabled Tracing with the -t all option. That's the "condensed" output:
Quote: |
/var/mqm/trace> grep MsgExit *
AMQ19542.FMT: 15:35:18.635803 19542.736 ObjectName(/var/mqm/exits/libmsgmon.so) LoadType(262144)
AMQ19542.FMT: 15:35:18.635849 19542.736 Module(/var/mqm/exits/libmsgmon.so) ErrorString((null))
AMQ19542.FMT: 15:35:18.638866 19542.736 Handle(805D5B8) Function((nil)) Module(/var/mqm/exits/libmsgmon.so)
AMQ19542.FMT: 15:35:18.638925 19542.736 RetCode = 20009535, rc1 = 536895861, rc2 = 0, Comment1 = 'EXIT.1.TO.2', Comment2 = '/var/mqm/exits/libmsgmon.so(MsgExit)', Comment3= '', File= 'amqrexta.c', Line= '4399'
AMQ19542.FMT: 15:35:19.060806 19542.736 RetCode = 20009535, rc1 = 536895861, rc2 = 0, Comment1 = 'EXIT.1.TO.2', Comment2 = '/var/mqm/exits/libmsgmon.so(MsgExit)', Comment3= '' |
Unfortunately, for me it's quite hard to understand. I have checked all the configuration, so this behavior could be only explained by a error in the program itself, but the SuportPack documentatios says it was tested... And I personally tested the precompiled dll for windows, It works fine.
Don't know what else I can do  |
|
Back to top |
|
 |
clindsey |
Posted: Mon Sep 13, 2004 3:20 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Sorry, I cannot tell anything from the return codes either. I was expecting to get a return code from dlload or dlsym.
I did build the exit and define it on my linux sytem. It loaded ok for me. I do not know what else to tell you.
Charlie |
|
Back to top |
|
 |
|