Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The need for pooling Producer is only apparent in some Components in Camel to support thread safe producers and support concurrency. And using pooling we can improve performance as we do not have the overhead of creating, starting and stopping the Producer at each invocation. So where is it needed then, well ? Well these components uses pooled producers:

...

By default Camel uses a shared org.apache.camel.impl.DefaultProducerServicePool provided by CamelContext. This default pool will pool up till 100 producers per Endpoint. So if you have 6 endpoints there can be up till 6 x 100 in total in the pool. However , where each distinct Endpoint have a limit of up till 100 producers.

...

Then set your custom pooling on the CamelContext with the setProducerServicePoll setProducerServicePool method.

Developing pooleable producers

The producer service pool identify a producer as being pool capable if the producer implements the marker interface org.apache.camel.SerivcePoolAware.
As the producer will be pooled and thus long lived, your producer should be able to automatic safely recover lost connection. Usually you implement logic that re connections connects if needed.

See Also