use of org.apache.camel.impl.DeferProducer in project camel by apache.
the class DeferServiceFactory method createProducer.
/**
* Creates the {@link Producer} which is deferred started until {@link org.apache.camel.CamelContext} is being started.
* <p/>
* When the producer is started, it re-lookup the endpoint to capture any changes such as the endpoint has been intercepted.
* This allows the producer to react and send messages to the updated endpoint.
*
* @param endpoint the endpoint
* @return the producer which will be deferred started until {@link org.apache.camel.CamelContext} has been started
* @throws Exception can be thrown if there is an error starting the producer
* @see org.apache.camel.impl.DeferProducer
*/
public static Producer createProducer(Endpoint endpoint) throws Exception {
Producer producer = new DeferProducer(endpoint);
endpoint.getCamelContext().deferStartService(producer, true);
return producer;
}
Aggregations