You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Grant Sheppard <gr...@intunity.com.au> on 2012/11/30 00:55:56 UTC

TransactionErrorHandler fails if Apache Camel context is shutting down?

Hi everyone,

I've been testing a route that receives messages from a JMS topic,
transforms them and then performs a POST to a REST service. One of my tests
involved shutting down the REST service to ensure that the redelivery
functionality was working (as well as rollback onto the JMS topic). This
functionality works fine whilst Apache Camel remains up and I can see the
rollbacks and redeliveries happening every minute, as per my configuration. 

However when I shutdown JBoss (which my Camel context is deployed within) I
hit a snag. The TransactionErrorHandler is invoked (as expected) whilst the
context is shutting down but the results are not pretty. What *seems* to be
happening is that it is attempting to create an instance of my redelivery
policy (which is defined as a Spring bean) but failing to do so because it
seems that the Spring context has also been told to commence shutdown (and
is refusing to create or retrieve anymore singleton beans). Consequently
this fails and then worst of all, the transaction commits and the original
message is taken off the JMS topic.

I've attached the relevant portion of the log file showing this behaviour.
Any advice would be appreciated!

Regards,

Grant Sheppard

transaction_rollback_failure.txt
<http://camel.465427.n5.nabble.com/file/n5723423/transaction_rollback_failure.txt>  



--
View this message in context: http://camel.465427.n5.nabble.com/TransactionErrorHandler-fails-if-Apache-Camel-context-is-shutting-down-tp5723423.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: TransactionErrorHandler fails if Apache Camel context is shutting down?

Posted by Grant Sheppard <gr...@intunity.com.au>.
Thanks, Claus. I've done this - the difficult part now is simulating the same
conditions that occurred the first time around to test it.



--
View this message in context: http://camel.465427.n5.nabble.com/TransactionErrorHandler-fails-if-Apache-Camel-context-is-shutting-down-tp5723423p5723506.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: TransactionErrorHandler fails if Apache Camel context is shutting down?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 30, 2012 at 1:04 AM, Grant Sheppard
<gr...@intunity.com.au> wrote:
> Further to what I previously wrote, to me at least the root cause seems to be
> that the Spring context is shutdown immediately regardless of whether you've
> specified a shutdown timeout for the Camel context.
>
> Does anyone know whether it's possible to only shutdown the Spring context
> after the Camel context is closed??
>

Its not so easy with Spring to setup shutdown ordering. Though what
you can is to use "depends-on" on the <bean> attributes,
and possible somehow tell spring that your beans is dependet on <camelContext>.

You need to set the id attribute in <camelContext> so your <bean> can
depend-on that id.



>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/TransactionErrorHandler-fails-if-Apache-Camel-context-is-shutting-down-tp5723423p5723424.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: TransactionErrorHandler fails if Apache Camel context is shutting down?

Posted by Grant Sheppard <gr...@intunity.com.au>.
Further to what I previously wrote, to me at least the root cause seems to be
that the Spring context is shutdown immediately regardless of whether you've
specified a shutdown timeout for the Camel context.

Does anyone know whether it's possible to only shutdown the Spring context
after the Camel context is closed??



--
View this message in context: http://camel.465427.n5.nabble.com/TransactionErrorHandler-fails-if-Apache-Camel-context-is-shutting-down-tp5723423p5723424.html
Sent from the Camel - Users mailing list archive at Nabble.com.