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 » IBM MQ API Support » Message exit sample code

Post new topic  Reply to topic
 Message exit sample code « View previous topic :: View next topic » 
Author Message
romudd
PostPosted: Fri Aug 27, 2004 7:57 am    Post subject: Message exit sample code Reply with quote

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
View user's profile Send private message MSN Messenger
vennela
PostPosted: Fri Aug 27, 2004 9:41 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
romudd
PostPosted: Mon Sep 06, 2004 3:51 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
clindsey
PostPosted: Mon Sep 06, 2004 9:46 am    Post subject: Reply with quote

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
View user's profile Send private message
romudd
PostPosted: Mon Sep 06, 2004 11:39 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
clindsey
PostPosted: Tue Sep 07, 2004 5:51 am    Post subject: Reply with quote

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
View user's profile Send private message
romudd
PostPosted: Wed Sep 08, 2004 2:04 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
clindsey
PostPosted: Wed Sep 08, 2004 2:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
romudd
PostPosted: Thu Sep 09, 2004 11:19 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
clindsey
PostPosted: Mon Sep 13, 2004 3:20 pm    Post subject: Reply with quote

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

MQSeries.net Forum Index » IBM MQ API Support » Message exit sample code
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.