camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Delaying start of Endpoint's Producer
Date Sat, 02 Jun 2012 12:02:49 GMT
On Wed, May 30, 2012 at 2:38 PM, Alex Anderson
<> wrote:
> I have a Producer attached to an Endpoint which takes some time to
> initialise.  Currently there is a bug that the Producer.produce()
> method can be passed messages while the Endpoint is still
> initialising.
> Would a correct solution to this be:
> a) block inside Producer.produce() until the endpoint is initialised
> b) throw an Exception in Producer.produce() if the endpoint is not initialised
> c) block inside Endpoint.createProducer() until the endpoint is initialised
> d) something else
> Thanks for any answers or thoughts.
> Alex

Do you initialization logic in the doStart / doStop method of your
producer, eg if you extend DefaultProducer.
If you do not extend any classes, then either extend ServiceSupport or
implement the Service interface.

See details about lifecycle of services

Then when Camel startup the routes is started, and the logic in
doStart is invoked etc. This ensures the producers
has all been properly started before routing starts.

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message