How to set the size of the producer cache in Camel's Recipient List?

Solution Verified - Updated -

Environment

  • JBoss Fuse 6.2.1
  • JBoss Fuse 6.3

Issue

I want to reduce the memory footprint of producer endpoints cached by the Camel recipient list. For now Camel seems to cache all the dynamically created producer endpoints. Can I configure the size of the recipient list producers cache?

Resolution

Starting from version 2.13.1/2.12.4 Camel allows you to configure the cache size for the ProducerCache used by recipient list which caches dynamically created producers for reuse. The name of the option is cacheSize. By default will use the default cache size which is 1000. Setting the value to -1 allows to turn off the cache all together.

See http://camel.apache.org/recipient-list.html for a documentation of this property.

An example would be:

from(...).
  recipientList().body().cacheSize(100);

Keep in mind that this option will be available starting from JBoss Fuse 6.2 onwards.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments