You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jonathan Schoreels <jo...@gmail.com> on 2017/05/16 13:39:36 UTC
CamelContext Fails to start when consuming from a down database
Hi all,
It seems that if a database is unreachable, and if the camelcontext
contains a sql consumer, the camel context won't start, even though marked
as Created in karaf console.
I don't mind the karaf "created" marked, but I would love to know if you
have any advice to startup sql route when the DB may be down, for example
if after a maintenance, the karaf is faster than the DB to restart.
A workaround found is to use a timer before, and the sql query in a
pollEnrich just after, but it's quite dirty.
You can find the whole stack here :
https://pastebin.com/XvYpCjZK
Jonathan Schoreels
Re: CamelContext Fails to start when consuming from a down database
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
I’ve dealt with situations like this using Blueprint reference-listeners.
Basically, I setup a reference listener to start the context when a service becomes available (or restart the context if the service implementation is switched). For this to work, I had to write a little code that exposed my DataSource as a service, but the service was only available when I could connect to the DB.
> On May 16, 2017, at 3:32 PM, Zoran Regvart <zo...@regvart.com> wrote:
>
> Hi Jonathan,
> I think we would like to address this with health checks[1], some of
> which shipped in 2.19.0 and we would like to improve on this.
>
> Perhaps it would be nice to tie health checks this into control bus
> and let the user define a policy on how to handle failures. But this
> is somewhat new territory that's still being developed, so perhaps if
> you're aware in advance of the database being unavailable you can use
> `camel:route-stop` to stop the route and `camel:route-start` to start
> it when the database is back online.
>
> zoran
>
> [1] https://issues.apache.org/jira/browse/CAMEL-10026
>
> On Tue, May 16, 2017 at 3:39 PM, Jonathan Schoreels
> <jo...@gmail.com> wrote:
>> Hi all,
>>
>> It seems that if a database is unreachable, and if the camelcontext
>> contains a sql consumer, the camel context won't start, even though marked
>> as Created in karaf console.
>>
>> I don't mind the karaf "created" marked, but I would love to know if you
>> have any advice to startup sql route when the DB may be down, for example
>> if after a maintenance, the karaf is faster than the DB to restart.
>>
>> A workaround found is to use a timer before, and the sql query in a
>> pollEnrich just after, but it's quite dirty.
>>
>> You can find the whole stack here :
>> https://pastebin.com/XvYpCjZK
>>
>> Jonathan Schoreels
>
>
>
> --
> Zoran Regvart
Re: CamelContext Fails to start when consuming from a down database
Posted by Zoran Regvart <zo...@regvart.com>.
Hi Jonathan,
I think we would like to address this with health checks[1], some of
which shipped in 2.19.0 and we would like to improve on this.
Perhaps it would be nice to tie health checks this into control bus
and let the user define a policy on how to handle failures. But this
is somewhat new territory that's still being developed, so perhaps if
you're aware in advance of the database being unavailable you can use
`camel:route-stop` to stop the route and `camel:route-start` to start
it when the database is back online.
zoran
[1] https://issues.apache.org/jira/browse/CAMEL-10026
On Tue, May 16, 2017 at 3:39 PM, Jonathan Schoreels
<jo...@gmail.com> wrote:
> Hi all,
>
> It seems that if a database is unreachable, and if the camelcontext
> contains a sql consumer, the camel context won't start, even though marked
> as Created in karaf console.
>
> I don't mind the karaf "created" marked, but I would love to know if you
> have any advice to startup sql route when the DB may be down, for example
> if after a maintenance, the karaf is faster than the DB to restart.
>
> A workaround found is to use a timer before, and the sql query in a
> pollEnrich just after, but it's quite dirty.
>
> You can find the whole stack here :
> https://pastebin.com/XvYpCjZK
>
> Jonathan Schoreels
--
Zoran Regvart
Re: CamelContext Fails to start when consuming from a down database
Posted by souciance <so...@gmail.com>.
Tricky situation, but as a workaround you can stop the context or route
from karaf. There are camel commands you can run. So if the DB is down due
to maintenance then you manually issue a command to stop the context and
start it after DB is up again. At least that way you don't get a lot of
error logs.
On Tue, May 16, 2017 at 3:58 PM, Jonathan Schoreels [via Camel] <
ml+s465427n5799625h38@n5.nabble.com> wrote:
> It looks like it comes from the exception is coming from
> the JdbcAggregationRepository, in fact.
>
> 2017-05-16 15:39 GMT+02:00 Jonathan Schoreels <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5799625&i=0>>
> :
>
> > Hi all,
> >
> > It seems that if a database is unreachable, and if the camelcontext
> > contains a sql consumer, the camel context won't start, even though
> marked
> > as Created in karaf console.
> >
> > I don't mind the karaf "created" marked, but I would love to know if you
> > have any advice to startup sql route when the DB may be down, for
> example
> > if after a maintenance, the karaf is faster than the DB to restart.
> >
> > A workaround found is to use a timer before, and the sql query in a
> > pollEnrich just after, but it's quite dirty.
> >
> > You can find the whole stack here :
> > https://pastebin.com/XvYpCjZK
> >
> > Jonathan Schoreels
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/CamelContext-Fails-to-
> start-when-consuming-from-a-down-database-tp5799623p5799625.html
> To start a new topic under Camel - Users, email ml+s465427n465428h31@n5.
> nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://camel.465427.n5.nabble.com/CamelContext-Fails-to-start-when-consuming-from-a-down-database-tp5799623p5799627.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CamelContext Fails to start when consuming from a down database
Posted by Jonathan Schoreels <jo...@gmail.com>.
It looks like it comes from the exception is coming from
the JdbcAggregationRepository, in fact.
2017-05-16 15:39 GMT+02:00 Jonathan Schoreels <jo...@gmail.com>
:
> Hi all,
>
> It seems that if a database is unreachable, and if the camelcontext
> contains a sql consumer, the camel context won't start, even though marked
> as Created in karaf console.
>
> I don't mind the karaf "created" marked, but I would love to know if you
> have any advice to startup sql route when the DB may be down, for example
> if after a maintenance, the karaf is faster than the DB to restart.
>
> A workaround found is to use a timer before, and the sql query in a
> pollEnrich just after, but it's quite dirty.
>
> You can find the whole stack here :
> https://pastebin.com/XvYpCjZK
>
> Jonathan Schoreels
>