Child pages
  • Ehcache
Skip to end of metadata
Go to start of metadata

Ehcache Component

Available as of Camel 2.18.x

The ehcache component enables you to perform caching operations using Ehcache 3 as the Cache Implementation.

This component supports producer and event based consumer endpoints.

The Cache consumer is an event based consumer and can be used to listen and respond to specific cache activities. 

Maven users will need to add the following dependency to their pom.xml for this component:

URI format

You can append query options to the URI in the following format, ?option=value&option=#beanRef&...

Component Options

Name

Default Value

Type

Description

Since
configuration

null

EhcacheConfiguration

The global component configuration

camel 2.20.x
cacheConfigurationnullCacheConfigurationThe default cache configuration to be used to create caches if configUri is not setcamel 2.20.x
cacheConfigurationUrinullStringURI pointing to the Ehcache XML configuration file's locationcamel 2.20.x
cacheManagernullCacheManagerThe cache manager, if set configuration and configurationUri are discarded camel 2.19.1

Endpoint Options

Name

Default Value

Description

configUri

null

URI pointing to the Ehcache XML configuration file's location (deprecated in camel 2.20.x)

configurationUrinullURI pointing to the Ehcache XML configuration file's location
configuration

null

The default cache configuration to be used to create caches if configUri is not set

cacheManagernullThe cache manager, if set configuration and configurationUri are discarded

createCacheIfNotExist

true

Configure if a cache need to be created if it does exist or can't be pre-configured.

action

null

To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence.

key

null

To configure the default action key. If a key is set in the message header, then the key from the header takes precedence.

keyType

java.lang.Object

The cache key type, default Object.class

valueType

java.lang.Object

The cache value type, default Object.class

eventOrdering

ORDERED

Set the the delivery mode (ordered, unordered), consumer only

eventFiring

ASYNCHRONOUS

Set the the delivery mode (synchronous, asynchronous), consumer only

eventTypes

EVICTED,EXPIRED,REMOVED,CREATED,UPDATED

Set the type of events to listen for, consumer only

Message Headers Camel 

 

Header

Type

Description

CamelEhcacheAction

String

The operation to be perfomed on the cache, valid options are:

  • CLEAR
  • PUT
  • PUT_ALL
  • PUT_IF_ABSENT
  • GET
  • GET_ALL
  • REMOVE
  • REMOVE_ALL
  • REPLACE

CamelEhcacheActionHasResult

Boolean

Set to true if the action has a result

CamelEhcacheActionSucceeded

Boolean

Set to true if the actionsuccedded

CamelEhcacheKeyObjectThe cache key used for an action
CamelEhcacheKeysSet<Object>A list of keys, used in
  • PUT_ALL
  • GET_ALL
  • REMOVE_ALL
CamelEhcacheValueObjectThe value to put in the cache or the result of an operation
CamelEhcacheOldValueObjectThe old value associated to a key for actions like PUT_IF_ABSENT or the Object used for comparison for actions like REPLACE
CamelEhcacheEventTypeEventTypeThe type of event received

Ehcache based idempotent repository example:

 

 

Ehcache based aggregation repository example:

 

  • No labels