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 Security » Stopping a Receiver channel with a channel exit

Post new topic  Reply to topic Goto page 1, 2  Next
 Stopping a Receiver channel with a channel exit « View previous topic :: View next topic » 
Author Message
jp97
PostPosted: Wed Mar 05, 2014 4:55 am    Post subject: Stopping a Receiver channel with a channel exit Reply with quote

Newbie

Joined: 19 Jun 2013
Posts: 9

So I originally thought this was because of my code, but then stripped it back to bare bones and even used Roger's blog example.
http://www.capitalware.com/rl_blog/?p=250

I have a qmgr on an AIX server, server A from here on out. And I have another qmgr on Linux, server B. B has the receiver channel with a security exit. When I start A's sender, B's receiver exit executes fine. When I stop A, B executes fine. If A is started and I stop B, it sits in "stopping" status, but if I then stop A, B will execute. I tried adding a log to find out what was going on, but it doesn't even seem like the exit is executing when I stop the receiver on B until I then stop A. Is there a reason to this or a work around? Not sure anyone would ever do this, but I can't just have it hang.
Back to top
View user's profile Send private message
JosephGramig
PostPosted: Wed Mar 05, 2014 5:31 am    Post subject: Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1244
Location: Gold Coast of Florida, USA

If you have read this topic much, then you would have seen the comment many times that "writing MQ exits is an advanced topic for very experienced MQ developers". It should be your last resort to achieve your requirements.

What are your requirements?
What do you want to achieve?
Back to top
View user's profile Send private message AIM Address
jp97
PostPosted: Wed Mar 05, 2014 6:00 am    Post subject: Reply with quote

Newbie

Joined: 19 Jun 2013
Posts: 9

This question doesn't have to do with my ability, but the lack of execution in this chain of events. The exit is simply not called when the receiver channel is manually stopped. I know this from adding a log as the first thing it does. Why would this not be called and instead get stuck in stopping?

Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <cmqc.h>
#include <cmqxc.h>
 
extern void MQENTRY MQStart(void) {;}
 
void MQENTRY Exit(
     PMQVOID pChannelExitParms,
     PMQVOID pChannelDefinition,
     PMQLONG pDataLength,
     PMQLONG pAgentBufferLength,
     PMQVOID pAgentBuffer,
     PMQLONG pExitBufferLength,
     PMQPTR  pExitBufferAddr)
{
    FILE *fp;
    struct tm *newtime;
    time_t tclock;
    char *timeBuff;
    PMQCXP pCEP = pChannelExitParms;
   
    fp = fopen("/var/mqm/exit.log", "a+");
   
    if(fp != NULL)
    {
        time( &tclock );
        newtime = localtime( &tclock );
        timeBuff = asctime(newtime);
        timeBuff[strlen(timeBuff) - 1] = 0x00;

        fprintf(fp, "%s : Now entering the security exit.\n", timeBuff);
       
        fclose(fp);
    }
 
    pCEP->ExitResponse = MQXCC_OK ;
    pCEP->ExitResponse2 = MQXR2_USE_AGENT_BUFFER;

    return;
}
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 05, 2014 6:05 am    Post subject: Reply with quote

Grand High Poobah

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

jp97 wrote:
This question doesn't have to do with my ability, but the lack of execution in this chain of events.


The question was nothing to do with your ability, but the accepted best practice of not using exits because they're arcane, only truly understood by Roger and often unnecessary to achieve a given objective. Witness the weirdness you yourself are posting about; exits kill queue managers.

If you're writing an exit because your hobbies include writing C code then cool. Building bombs in your basement might be a safer way to ease into this.

Roger will be along in a moment to explain what's happening here.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 05, 2014 7:20 am    Post subject: Re: Stopping a Receiver channel with a channel exit Reply with quote

Poobah

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

jp97 wrote:
B has the receiver channel with a security exit.

You only have a security exit on B? Not on A? Security exits normally work in pairs to exchange authentication information before the channel starts.

Exactly what behavior were you expecting?
_________________
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
jp97
PostPosted: Wed Mar 05, 2014 10:04 am    Post subject: Reply with quote

Newbie

Joined: 19 Jun 2013
Posts: 9

I was originally doing this on a receive exit and it did the same thing. For this example I mentioned it as a security exit. The behavior is the same. The exit doesn't get called until the sender is stopped.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Mar 05, 2014 10:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/topic/com.ibm.mq.dev.doc/q028100_.htm
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 05, 2014 10:27 am    Post subject: Reply with quote

Poobah

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

jp97 wrote:
I was originally doing this on a receive exit and it did the same thing. For this example I mentioned it as a security exit. The behavior is the same. The exit doesn't get called until the sender is stopped.

What is the point of having a security exit on only one end of the channel?

What is that exit supposed to do?

Did you merely move the exit from sender to receiver? Why do you believe moving the exit from sender to receiver is going to improve the behavior you see?

Given your research into channel exits, exactly when is a security exit called?

Does the channel successfully start? That is, does the channel go to RUNNING state? Do messages flow?

Please answer all of these questions.
_________________
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
bruce2359
PostPosted: Wed Mar 05, 2014 10:54 am    Post subject: Reply with quote

Poobah

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

mqjeff wrote:
http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/topic/com.ibm.mq.dev.doc/q028100_.htm


The OP wrote:
Quote:
receiver channel with a security exit

_________________
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
mqjeff
PostPosted: Wed Mar 05, 2014 11:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

bruce2359 wrote:
mqjeff wrote:
http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/topic/com.ibm.mq.dev.doc/q028100_.htm


The OP wrote:
Quote:
receiver channel with a security exit

Quote:
I was originally doing this on a receive exit and it did the same thing


And forgive me for assuming that the OP could also find the same topic on security exits.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 05, 2014 11:07 am    Post subject: Reply with quote

Poobah

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

jp97 wrote:
I was originally doing this on a receive exit and it did the same thing. For this example I mentioned it as a security exit. The behavior is the same. The exit doesn't get called until the sender is stopped.

You were doing exactly what in the exit?

Please, oh please, reply to our questions. Did the channel ever go to RUNNING state? Before you added the exit? After you added the exit? Did messages flow?
_________________
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
jp97
PostPosted: Wed Mar 05, 2014 12:20 pm    Post subject: Reply with quote

Newbie

Joined: 19 Jun 2013
Posts: 9

Sorry, have been in a meeting all afternoon.

I am monitoring the channel status.

Yes, the channels can connect and transfer messages.

I originally had this in receive exit but tried it on a security to see if that made a difference.

Everything works, except if you attempt to stop the receiver channel while connected. It stays its stopping, without calling any exits. But if you then initiate the stop from the sender, the exit happens and all is good.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 05, 2014 12:30 pm    Post subject: Reply with quote

Grand High Poobah

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

jp97 wrote:
I am monitoring the channel status.


With an exit?

This is what we meant earlier about "what are you trying to achieve?"

There are easier ways to monitor the health & status of a channel than this.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jp97
PostPosted: Wed Mar 05, 2014 12:35 pm    Post subject: Reply with quote

Newbie

Joined: 19 Jun 2013
Posts: 9

Was told to try to use one.
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Wed Mar 05, 2014 12:46 pm    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

The behaviour you are seeing is, I believe, totally expected. A sender/receiver channel pair is essentially half-duplex. (and I don't really want to get in to debates about pipelining). When a sender/receiver channel is in 'resting' state the sender is in an MQGET and the receiver is in a TCP recv(). When you issue a STOP CHANNEL (without using the force options) on a receiver you are really just saying 'stop when next convenient'. Well, the next convenient time will be when the sender sends a message or you receive a heartbeat.

So, try your experiment again but this time wait for heartbeat seconds or just send a message down the channel.

Cheers,
Paul.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Security » Stopping a Receiver channel with a channel exit
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.