Search in sources :

Example 1 with DeferProducer

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;
}
Also used : DeferProducer(org.apache.camel.impl.DeferProducer) Producer(org.apache.camel.Producer) DeferProducer(org.apache.camel.impl.DeferProducer)

Aggregations

Producer (org.apache.camel.Producer)1 DeferProducer (org.apache.camel.impl.DeferProducer)1