You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Jason Schlauch <ja...@gmail.com> on 2010/01/12 02:19:11 UTC

Subscription Manager Exceptions (was Re: How do you stop a subscription manager with a busy message listener)

On Mon, Jan 11, 2010 at 5:48 AM, Gordon Sim <gs...@redhat.com> wrote:
> Note that there is a problem with SubscriptionManager::start() in that you
> are unable to handle any exceptions thrown during dispatching. For that
> reason I would advocate using SubscriptionManager::run(), starting your own
> thread for it if so desired.

I ran into this recently, and by "this" I mean that it appears
impossible to catch exceptions thrown when using the async
SubscriptionManager methods.  Is this actually the case or am I
missing something?  Is there a way to join the async thread to handle
the exception or some way to otherwise register an exception handler?

Connection exceptions are thrown by the async threads when the broker
process is restarted.  Since no exception handler is present
std::terminate() is called which brings down the whole client
application.

Is the only solution to this to bring my own thread where I can wrap
exception handlers around the synchronous SubscriptionManager methods?

--jason

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


Re: Subscription Manager Exceptions (was Re: How do you stop a subscription manager with a busy message listener)

Posted by Gordon Sim <gs...@redhat.com>.
On 01/12/2010 01:19 AM, Jason Schlauch wrote:
> On Mon, Jan 11, 2010 at 5:48 AM, Gordon Sim<gs...@redhat.com>  wrote:
>> Note that there is a problem with SubscriptionManager::start() in that you
>> are unable to handle any exceptions thrown during dispatching. For that
>> reason I would advocate using SubscriptionManager::run(), starting your own
>> thread for it if so desired.
>
> I ran into this recently, and by "this" I mean that it appears
> impossible to catch exceptions thrown when using the async
> SubscriptionManager methods.  Is this actually the case or am I
> missing something?  Is there a way to join the async thread to handle
> the exception or some way to otherwise register an exception handler?
>
> Connection exceptions are thrown by the async threads when the broker
> process is restarted.  Since no exception handler is present
> std::terminate() is called which brings down the whole client
> application.
>
> Is the only solution to this to bring my own thread where I can wrap
> exception handlers around the synchronous SubscriptionManager methods?

At the moment, that is indeed the only solution. As it stands 
SubscriptionManager::start() is not really usable. All it does however 
is call SubscriptionManager::run() on a new thread so it should be easy 
to replace with your own safer equivalent.

I've added a Jira for that and will put in some sort of fix for that. 
(https://issues.apache.org/jira/browse/QPID-2337)

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