[openamq-dev] Disconnect notification between two peers

Martin Lucina mato at imatix.com
Wed Nov 7 10:14:40 CET 2007


Mike,

mikeowens at gmail.com said:
> I hope I am not coming across as demanding. I am just trying to find the best
> way for me to solve this problem. If I have to implement a ping/timeout on the
> server, that's fine. It's easy to do with AMQ. I just want to make sure up
> front that I am taking the best approach possible. That is why I am asking.

There's no way to do what you're asking in the protocol.  You have three
options:

1) Have the service publish it's replies to the client with the
   mandatory and immediate flags set to 1.  You'll get a basic.return
   back from OpenAMQ if the client is no longer there.

2) Have the service regularly publish a 'ping' message (with mandatory and
   immediate set to 1) to the client. If the client goes away, you'll
   get a basic.return back. The client can just ignore the 'ping'
   messages.

3) As for 2), but have the client actually send a 'pong' back if it
   receives a 'ping' from the service.

1) is good enough if you don't need to know quickly that the client went
away, only the next time you try to talk to it. 

The difference between 2) and 3) is that 3) handles the case where the
client is connected to OpenAMQ but the application has gone off into
la-la land.

In your case (Apache-style worker pool of services) you probably want 2)
but might want 3) if you want to be extra sure that the client is
actually alive and kicking.

As for doing it via the console API/working out some other notification
mechanism, Pieter would be the best person to answer that question. 

-mato



More information about the openamq-dev mailing list