You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Jiri Krutil <ji...@krutil.com> on 2011/06/17 14:56:17 UTC

How to detect connection shutdown or channel error?

Hi

I'm trying to understand how to detect AMQP connection and channel  
(session) errors in the C++ messaging API.

As far as I can tell, there is no mechanism for registration of client  
on-error callbacks in the API.

Since the API only allows synchronous messages receiving (there are no  
message listeners), I guess one can be safe in assuming that all is  
well as long as no exceptions are thrown by the API functions called  
from the client app. Only then should one become suspicious and  
perhaps verify the connection and session status.

Is that assumption correct? If yes, what is the right way to check the  
connection and session status? Is it sufficient to check the result of  
Connection::isOpen() and Session::hasError()?

Any help is much appreciated.

Cheers
Jiri


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: How to detect connection shutdown or channel error?

Posted by Gordon Sim <gs...@redhat.com>.
On 06/17/2011 01:56 PM, Jiri Krutil wrote:
> Hi
>
> I'm trying to understand how to detect AMQP connection and channel
> (session) errors in the C++ messaging API.
>
> As far as I can tell, there is no mechanism for registration of client
> on-error callbacks in the API.
>
> Since the API only allows synchronous messages receiving (there are no
> message listeners), I guess one can be safe in assuming that all is well
> as long as no exceptions are thrown by the API functions called from the
> client app. Only then should one become suspicious and perhaps verify
> the connection and session status.
>
> Is that assumption correct? If yes, what is the right way to check the
> connection and session status? Is it sufficient to check the result of
> Connection::isOpen() and Session::hasError()?

Yes, that should be sufficient. Any attempt to use a session on which an 
AMQP level error occurred will result in the exception being thrown again.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


RE: How to detect connection shutdown or channel error?

Posted by Steve Huston <sh...@riverace.com>.
Hi Jiri,

The C++ API will throw exceptions when errors occur.
There's a very brief example in
http://qpid.apache.org/books/0.10/Programming-In-Apache-Qpid/html/index.
html section 2.1

-Steve

--
Steve Huston, Riverace Corporation
Total Lifecycle Support for Your Networked Applications
http://www.riverace.com


> -----Original Message-----
> From: Jiri Krutil [mailto:jiri@krutil.com] 
> Sent: Friday, June 17, 2011 8:56 AM
> To: users@qpid.apache.org
> Subject: How to detect connection shutdown or channel error?
> 
> 
> Hi
> 
> I'm trying to understand how to detect AMQP connection and channel  
> (session) errors in the C++ messaging API.
> 
> As far as I can tell, there is no mechanism for registration 
> of client  
> on-error callbacks in the API.
> 
> Since the API only allows synchronous messages receiving 
> (there are no  
> message listeners), I guess one can be safe in assuming that all is  
> well as long as no exceptions are thrown by the API functions called  
> from the client app. Only then should one become suspicious and  
> perhaps verify the connection and session status.
> 
> Is that assumption correct? If yes, what is the right way to 
> check the  
> connection and session status? Is it sufficient to check the 
> result of  
> Connection::isOpen() and Session::hasError()?
> 
> Any help is much appreciated.
> 
> Cheers
> Jiri
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 
> 


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org