Chapter 5. Running Red Hat JBoss Data Grid with Apache Camel
5.1. The camel-jbossdatagrid Component Copy linkLink copied to clipboard!
camel-jbossdatagrid component includes the following features:
- Local Camel Consumer
Receives cache change notifications and sends them to be processed. This can be done synchronously or asynchronously, and is also supported with a replicated or distributed cache.
- Local Camel Producer
A producer creates and sends messages to an endpoint. The
camel-jbossdatagridproducer usesGET,PUT,REMOVE, andCLEARoperations. The local producer is also supported with a replicated or distributed cache. - Remote Camel Producer
In Remote Client-Server mode, the Camel producer can send messages using Hot Rod.
camel-jbossdatagrid dependency must be added to the pom.xml file to run JBoss Data Grid with Camel:
Note
camel-jbossdatagrid component ships with JBoss Data Grid, and is not included in the JBoss Fuse 6.1 or JBoss Fuse Service Works 6.0 distributions.
FileComponent is referred to in a URI as file, which creates FileEndpoints.
The following URI format is used for camel-jbossdatagrid:
infinispan://hostname?[options]
infinispan://hostname?[options]
The producer can create and send messages to a local JBoss Data Grid cache configured in the registry, or to a remote cache using the Hot Rod protocol. If a cacheContainer is present, the cache will be local. If it is not present, the cache will try to connect to remote cache using the supplied hostname/port.
| Name | Default Value | Type | Context | Description |
|---|---|---|---|---|
| cacheContainer | null | CacheContainer | Shared | Reference to a org.infinispan.manager.CacheContainer in the Registry. |
| cacheName | null | String | Shared | The cache name to use. If not specified, the default cache is used. |
| command | PUT | String | Producer | The operation to perform. Only the PUT, GET, REMOVE, and CLEAR values are currently supported. |
| eventTypes | null | Set<String> | Consumer | The event types to register. By default, this listens for all event types. Possible values are defined in org.infinispan.notifications.cachelistener.event.Event.Type |
| sync | true | Boolean | Consumer | By default the consumer will receive notifications synchronously by the same thread that process the cache operation. |
| clustered | false | Boolean | Consumer | By default the consumer will only receive local events. By using this option, the consumer also listens to events originated on other nodes in the cluster. The only events available for clustered listeners are CACHE_ENTRY_CREATED, CACHE_ENTRY_REMOVED, and CACHE_ENTRY_MODIFIED. |
| Name | Default Value | Type | Context | Description |
|---|---|---|---|---|
| CamelInfinispanCacheName | null | String | Shared | The cache participating in the operation or event. |
| CamelInfinispanOperation | PUT | String | Producer | The operation to perform: CamelInfinispanOperationPut, CamelInfinispanOperationGet, CamelInfinispanOperationRemove, CamelInfinispanOperationClear. |
| CamelInfinispanKey | null | Object | Shared | The key to perform the operation to or the key generating the event. |
| CamelInfinispanValue | null | Object | Producer | The value to use for the operation. |
| CamelInfinispanOperationResult | null | Object | Producer | The result of the operation. |
| CamelInfinispanEventType | null | String | Consumer | The type of the received event. Possible values are defined in org.infinispan.notifications.cachelistener.event.Event.Type |
| CamelInfinispanIsPre | null | Boolean | Consumer | Infinispan fires two events for each operation: one before and one after the operation. |