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 » User Exits » Under which process does API-exit run?

Post new topic  Reply to topic Goto page 1, 2  Next
 Under which process does API-exit run? « View previous topic :: View next topic » 
Author Message
yashgt
PostPosted: Mon Nov 30, 2015 7:11 am    Post subject: Under which process does API-exit run? Reply with quote

Apprentice

Joined: 11 Nov 2014
Posts: 38

Hi,

If I configure a library as the API Exit for a Queue Manager, do the functions in the library run within the process space of the Application that makes the MQPUT and MQGET and other calls?
Or do the functions run in the process space of the Queue Manager?

Regards,
Yash
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Nov 30, 2015 7:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

They run as part of the queue manager thread. That's why a badly written exit can cause so much potential damage & instability.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
markt
PostPosted: Mon Nov 30, 2015 8:39 am    Post subject: Reply with quote

Knight

Joined: 14 May 2002
Posts: 502

They run on the application thread. Though of course, some "applications" are actually qmgr processes and therefore will also run the API exit.
Back to top
View user's profile Send private message
yashgt
PostPosted: Mon Nov 30, 2015 9:20 am    Post subject: Reply with quote

Apprentice

Joined: 11 Nov 2014
Posts: 38

The responses contradict each other.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Nov 30, 2015 9:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

yashgt wrote:
The responses contradict each other.


The klein bottle is correct.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 30, 2015 9:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

yashgt wrote:
The responses contradict each other.

They do not. They complement each other. Both hold a kernel of truth.

All depends on timing, exit type, programming language used. The exits may be called multiple times.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
yashgt
PostPosted: Mon Nov 30, 2015 10:20 am    Post subject: Reply with quote

Apprentice

Joined: 11 Nov 2014
Posts: 38

So if an application A1 connects to Q Manager QM1 and makes an MQPUT, the API exit will get called. If the API exit tries to print its own process ID, will it be the process ID of A1 or will it be of QM1?

If it is the ID of the A1 process, an exit() done by the API-exit function, should not cause any other applications to be affected. right?
Back to top
View user's profile Send private message
tczielke
PostPosted: Mon Nov 30, 2015 1:01 pm    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 939
Location: Illinois, USA

MQ comes with an amqsaxe sample API exit executable (i.e. /opt/mqm/samp/bin/amqsaxe on Linux) that is pretty simple to set up and test out the answer to your question. The provided amqsaxe0.c source (i.e. /opt/mqm/samp/amqsaxe0.c on Linux) also gives examples of how to set up this exit. If you run this test with say the amqsput sample, you will see that the API exit runs under the ampsput address space when the PUT is invoked by amqsput.

As far as calling the exit function from the ApiExit, that would not be advisable, unless you want your application to come to a crashing halt!
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Dec 01, 2015 1:58 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

The last few posts here have brought up some questions. I'm mostly an MVS internals guy, so forgive my questions if they use mainframe terminology.

When is an exit fetched from the .dll library? Qmgr startup? First use?

Is only one instance fetched? Or does each app that calls the .dll get a copy? Is the .dll exit code re-entrant - mainframe-speak indicating that the .dll does not modify itself in any way (create state-data, for example)? Re-entrant code allows multiple callers to use the same instance of the code.
_________________
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 Dec 01, 2015 3:00 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

bruce2359 wrote:
The last few posts here have brought up some questions. I'm mostly an MVS internals guy, so forgive my questions if they use mainframe terminology.

When is an exit fetched from the .dll library? Qmgr startup? First use?

Is only one instance fetched? Or does each app that calls the .dll get a copy? Is the .dll exit code re-entrant - mainframe-speak indicating that the .dll does not modify itself in any way (create state-data, for example)? Re-entrant code allows multiple callers to use the same instance of the code.


DLL = Dynamic Link Library. Windows loads it into each process when it is first called. Should always be coded as re-entrant (module only contains static constant data).
_________________
Glenn
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Dec 01, 2015 6:16 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

gbaddeley wrote:
DLL = Dynamic Link Library. Windows loads it into each process when it is first called. Should always be coded as re-entrant (module only contains static constant data).

Still a bit confused.

By "into each process" do you mean each qmgr process? Or does "into each process" mean each app process which calls the API exit? If the former, then there is only one instance of the exit - per qmgr. If the latter, there will be n instances - one for each concurrent app calling the API.

Re-entrant in MVS-speak also means that if the exit needs to store any data (count something, or compose a print-line, as examples), it must acquire that storage in the address-space of the caller.
_________________
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
tczielke
PostPosted: Tue Dec 01, 2015 7:18 pm    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 939
Location: Illinois, USA

Using Linux as an example, the API exit would be loaded into each application process. For example, if you had 100 amqpsut processes running, each one would have the API exit loaded in their address space. However, the exit is a shared object file that is memory mapped. So in reality, all 100 exits are pointing at the same copy of the module (the executable part) in physical storage. Of course, each process would have its own separate data section of the exit.

Here are some comparisons I have in my mind between z/OS and distributed.

1) address space in z/OS is similar to a distributed process
2) TCB in z/OS is similar to a distributed thread
3) cross memory services is kind of like distributed shared memory, but cross memory services is much more sophisticated.
4) The z/OS subspace group facility is one of the cleverest things I have ever seen with an operating system and I have never seen anything remotely like that in a distributed operating system . . .

In my opinion, z/OS is vastly more sophisticated and robust than distributed systems. But maybe that is just me.
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Dec 02, 2015 9:39 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

tczielke wrote:
But maybe that is just me.

In a job interview, I was once asked which was my favorite operating system. Generally, my reply remains the same, namely: the o/s that meets the business requirements of the client. Over a beer, I'll be more precise.
_________________
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
yashgt
PostPosted: Wed Dec 02, 2015 2:13 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Nov 2014
Posts: 38

Here is something that confuses me. The application may be a Java program. If the API exit function runs in the process space of the application, how is it that a library written in C gets executed in a JVM?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 02, 2015 2:50 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

yashgt wrote:
Here is something that confuses me. The application may be a Java program. If the API exit function runs in the process space of the application, how is it that a library written in C gets executed in a JVM?

There is a standard JNI call for those libraries. Especially the security exits (client side).

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » User Exits » Under which process does API-exit run?
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.