Versions Compared

Key

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

...

Name

Type

Description

hazelcast.operation.type

String

valid values are: put, delete, get, update, query

hazelcast.objectId

String

the object id to store / find your object inside the cache (not needed for the query operation)

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

CamelHazelcastOperationType

String

valid values are: put, delete, get, update, query Available as of Camel 2.8

CamelHazelcastObjectId

String

the object id to store / find your object inside the cache (not needed for the query operation) Available as of Camel 2.8

You can call the samples with:

...

Code Block
<route>
	<from uri="direct:put" />
	<setHeader headerName="hazelcast.operation.type">
		<constant>put</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>
Sample for get:

Starting Camel version 2.8

Code Block

<route>
	<from uri="direct:put" />
	<setHeader headerName="CamelHazelcastOperationType">
		<constant>put</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>
Sample for get:

Java Java DSL:

Code Block
from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))	
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.to("seda:out");

...

Code Block
<route>
	<from uri="direct:get" />
	<setHeader headerName="hazelcast.operation.type">
		<constant>get</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
	<to uri="seda:out" />
</route>
Sample for update:

Java DSL:

Code Block

from("direct:update")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.UPDATE_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);

Spring DSL:

Starting Camel version 2.8

Code Block

<route>
	<from 
Code Block

<route>
	<from uri="direct:updateget" />
	<setHeader headerName="hazelcast.operation.typeCamelHazelcastOperationType">
		<constant>update<<constant>get</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
	<to uri="seda:out" />
</route>
Sample for

...

update:

Java DSL:

Code Block
from("direct:deleteupdate")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DELETEUPDATE_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);

...

Code Block
<route>
	<from uri="direct:deleteupdate" />
	<setHeader headerName="hazelcast.operation.type">
		<constant>delete<<constant>update</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>

Starting Camel version 2.8

Code Block

<route>
	<from uri="direct:update" />
	<setHeader headerName="CamelHazelcastOperationType">
		<constant>update</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>
Sample for

...

delete:

Java DSL:

Code Block
from("direct:querydelete")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.QUERYDELETE_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.to("seda:out");

Spring DSL:

Code Block
<route>
	<from uri="direct:querydelete" />
	<setHeader headerName="hazelcast.operation.type">
		<constant>query<<constant>delete</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>

Starting Camel version 2.8

Code Block

<route>
	<from uri="direct:delete" />
	<setHeader headerName="CamelHazelcastOperationType">
		<constant>delete</constant>
	</setHeader>
	<to uri="sedahazelcast:map:outfoo" />
</route>
Sample for query

Java DSL:For the query operation Hazelcast offers a SQL like syntax to query your distributed map.

Code Block
String q1 = "bar > 1000";
template.sendBodyAndHeader("direct:query", null, HazelcastConstants.QUERY, q1);

map cache consumer - from("hazelcast:map:foo")

Hazelcast provides event listeners on their data grid. If you want to be notified if a cache will be manipulated, you can use the map consumer. There're 4 events: put, update, delete and envict. The event type will be stored in the "hazelcast.listener.action" header variable. The map consumer provides some additional information inside these variables:

Header Variables inside the response message:

from("direct:query")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.QUERY_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.to("seda:out");

Spring DSL:

Code Block

<route>
	<from uri="direct:query" />
	<setHeader headerName="hazelcast.operation.type">
		<constant>query</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
	<to uri="seda:out" />
</route>

Starting Camel version 2.8

Code Block

<route>
	<from uri="direct:query" />
	<setHeader headerName="CamelHazelcastOperationType">
		<constant>query</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
	<to uri="seda:out" />
</route>

For the query operation Hazelcast offers a SQL like syntax to query your distributed map.

Code Block

String q1 = "bar > 1000";
template.sendBodyAndHeader("direct:query", null, HazelcastConstants.QUERY, q1);

map cache consumer - from("hazelcast:map:foo")

Hazelcast provides event listeners on their data grid. If you want to be notified if a cache will be manipulated, you can use the map consumer. There're 4 events: put, update, delete and envict. The event type will be stored in the "hazelcast.listener.action" header variable. The map consumer provides some additional information inside these variables:

Header Variables inside the response message:

Name

Type

Description

hazelcast.listener.time

Long

time of the event in millis

hazelcast.listener.type

String

the map consumer sets here "cachelistener"

hazelcast.listener.action

String

type of event - here added, updated, envicted and removed

hazelcast.objectId

String

the oid of the object

hazelcast.cache.name

String

the name of the cache - e.g. "foo"

hazelcast.cache.type

String

the type of the cache - here map

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

CamelHazelcastListenerTime

Long

time of the event in millis Available as of Version 2.8

CamelHazelcastListenerType

String

the map consumer sets here "cachelistener" Available as of Version 2.8

CamelHazelcastListenerAction

String

type of event - here added, updated, envicted and removed. Available as of Version 2.8

CamelHazelcastObjectId

String

the oid of the object

CamelHazelcastCacheName

String

the name of the cache - e.g. "foo"

CamelHazelcastCacheType

String

the type of the cache - here map

The object value will be stored within put and update actions inside the message body.

Here's a sample:

Code Block

fromF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.log("object...")
.choice()
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
         .log("...added")
         .to("mock:added")
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ENVICTED))
         .log("...envicted")
         .to("mock:envicted")
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.UPDATED))
         .log("...updated")
         .to("mock:updated")
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.REMOVED))
         .log("...removed")
         .to("mock:removed")
    .otherwise()
         .log("fail!");

Anchor
multimap
multimap

Usage of Multi Map

multimap cache producer - to("hazelcast:multimap:foo")

A multimap is a cache where you can store n values to one key. The multimap producer provides 4 operations (put, get, removevalue, delete).

Header Variables for the request message:

Name

Type

Description

hazelcast.operation.type

String

valid values are: put, get, removevalue, delete

hazelcast.objectId

String

the object id to store / find your object inside the cache

Warning

Header variables have changed in Camel 2.8

Hazelcast Component

Available as of Camel 2.7

The hazelcast: component allows you to work with the Hazelcast distributed data grid / cache. Hazelcast is a in memory data grid, entirely written in Java (single jar). It offers a great palette of different data stores like map, multi map (same key, n values), queue, list and atomic number. The main reason to use Hazelcast is its simple cluster support. If you have enabled multicast on your network you can run a cluster with hundred nodes with no extra configuration. Hazelcast can simply configured to add additional features like n copies between nodes (default is 1), cache persistence, network configuration (if needed), near cache, enviction and so on. For more information consult the Hazelcast documentation on http://www.hazelcast.com/documentation.jsp.

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

Code Block
xml
xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-hazelcast</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

Code Block

hazelcast:[ map | multimap | queue | seda | set | atomicvalue | instance]:cachename[?options]
Warning

You have to use the second prefix to define which type of data store you want to use.

Sections

  1. Usage of #map
  2. Usage of #multimap
  3. Usage of #queue
  4. Usage of #list
  5. Usage of #seda
  6. Usage of atomic number
  7. Usage of #cluster support (instance)

Anchor
map
map

Usage of Map

map cache producer - to("hazelcast:map:foo")

If you want to store a value in a map you can use the map cache producer. The map cache producer provides 5 operations (put, get, update, delete, query). For the first 4 you have to provide the operation inside the "hazelcast.operation.type" header variable. In Java DSL you can use the constants from org.apache.camel.component.hazelcast.HazelcastConstants.

Header Variables for the request message:

Name

Type

Description

hazelcast.operation.type

String

valid values are: put, delete, get, update, query

hazelcast.objectId

String

the object id to store / find your object inside the cache (not needed for the query operation)

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

CamelHazelcastOperationType

String

valid values are: put, delete, get, update, query Available as of Camel 2.8

CamelHazelcastObjectId

String

the object id to store / find your object inside the cache (not needed for the query operation) Available as of Camel 2.8

You can call the samples with:

Code Block

template.sendBodyAndHeader("direct:[put|get|update|delete|query]", "my-foo", HazelcastConstants.OBJECT_ID, "4711");
Sample for put:

Java DSL:

Code Block

from("direct:put")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))	
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);

Spring DSL:

Code Block

<route>
	<from uri="direct:put" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>put</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>
Sample for get:

Java DSL:

Code Block

from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))	
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.to("seda:out");

Spring DSL:

Code Block

<route>
	<from uri="direct:get" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>get</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
	<to uri="seda:out" />
</route>
Sample for update:

Java DSL:

Code Block

from("direct:update")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.UPDATE_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);

Spring DSL:

Code Block

<route>
	<from uri="direct:update" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>update</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>
Sample for delete:

Java DSL:

Code Block

from("direct:delete")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DELETE_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);

Spring DSL:

Code Block

<route>
	<from uri="direct:delete" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>delete</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
</route>
Sample for query

Java DSL:

Code Block

from("direct:query")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.QUERY_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.to("seda:out");

Spring DSL:

Code Block

<route>
	<from uri="direct:query" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>query</constant>
	</setHeader>
	<to uri="hazelcast:map:foo" />
	<to uri="seda:out" />
</route>

For the query operation Hazelcast offers a SQL like syntax to query your distributed map.

Code Block

String q1 = "bar > 1000";
template.sendBodyAndHeader("direct:query", null, HazelcastConstants.QUERY, q1);

map cache consumer - from("hazelcast:map:foo")

Hazelcast provides event listeners on their data grid. If you want to be notified if a cache will be manipulated, you can use the map consumer. There're 4 events: put, update, delete and envict. The event type will be stored in the "hazelcast.listener.action" header variable. The map consumer provides some additional information inside these variables:

Header Variables inside the response message:

Name

Type

Description

hazelcast.listener.time

Long

time of the event in millis

hazelcast.listener.type

String

the map consumer sets here "cachelistener"

hazelcast.listener.action

String

type of event - here added, updated, envicted and removed

hazelcast.objectId

String

the oid of the object

hazelcast.cache.name

String

the name of the cache - e.g. "foo"

hazelcast.cache.type

String

the type of the cache - here map

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

CamelHazelcastListenerTime

Long

time of the event in millis Available as of Version 2.8

CamelHazelcastListenerType

String

the map consumer sets here "cachelistener" Available as of Version 2.8

CamelHazelcastListenerAction

Name

Type

Description

hazelcast.listener.time

Long

time of the event in millis

hazelcast.listener.type

String

the map consumer sets here "cachelistener"

hazelcast.listener.action

String

type of event - here added, updated, envicted and removed. Available as of Version 2.8

CamelHazelcastObjectId hazelcast.objectId

String

the oid of the object Available as of Version 2.8

CamelHazelcastCacheName hazelcast.cache.name

String

the name of the cache - e.g. "foo" Available as of Version 2.8

CamelHazelcastCacheType hazelcast.cache.type

String

the type of the cache - here map Available as of Version 2.8

The object value will be stored within put and update actions inside the message body.

...

Code Block
fromF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
.log("object...")
.choice()
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
         .log("...added")
         .to("mock:added")
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ENVICTED))
         .log("...envicted")
         .to("mock:envicted")
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.UPDATED))
         .log("...updated")
         .to("mock:updated")
    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.REMOVED))
         .log("...removed")
         .to("mock:removed")
    .otherwise()
         .log("fail!");

Anchor
multimap
multimap

Usage of Multi Map

multimap cache producer - to("hazelcast:multimap:foo")

A multimap is a cache where you can store n values to one key. The multimap producer provides 4 operations (put, get, removevalue, delete).

Header Variables for the request message:

).

Header Variables for the request message:

Name

Type

Description

hazelcast.operation.type

String

valid values are: put, get, removevalue, delete

hazelcast.objectId

String

the object id to store / find your object inside the cache

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

hazelcast.operation.type CamelHazelcastOperationType

String

valid values are: put, get, removevalue, delete Available as of Version 2.8

CamelHazelcastObjectId hazelcast.objectId

String

the object id to store / find your object inside the cache Available as of Version 2.8

Sample for put:

Java DSL:

Code Block
from("direct:put")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX));

Spring DSL:

Code Block

<route>
	<from uri="direct:put" />
	<log message="put.."/
<route>
	<from uri="direct:put" />
	<log message="put.."/>
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>put</constant>
	</setHeader>
	<to uri="hazelcast:multimap:foo" />
</route>

...

Code Block
from("direct:removevalue")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX);

Spring DSL:

Code Block

<route>
	<from uri="direct:removevalue" />
	<log message="removevalue..."/
<route>
	<from uri="direct:removevalue" />
	<log message="removevalue..."/>
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>removevalue</constant>
	</setHeader>
	<to uri="hazelcast:multimap:foo" />
</route>

To remove a value you have to provide the value you want to remove inside the message body. If you have a multimap object {key: "4711" values: { "my-foo", "my-bar"}} you have to put "my-foo" inside the message body to remove the "my-foo" value.

Sample for get:

Java DSL:

Code Block
from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX)
.to("seda:out");

Spring DSL:

Code Block

<route>
	<from uri="direct:get" />
	<log message="get.."/>
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" --
Code Block

<route>
	<from uri="direct:get" />
	<log message="get.."/>
	<setHeader headerName="hazelcast.operation.type">
		<constant>get</constant>
	</setHeader>
	<to uri="hazelcast:multimap:foo" />
	<to uri="seda:out" />
</route>
Sample for delete:

Java DSL:

Code Block
from("direct:delete")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DELETE_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX); 

...

Code Block
<route>
	<from uri="direct:delete" />
	<log message="delete.."/delete" />
	<log message="delete.."/>
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>delete</constant>
	</setHeader>
	<to uri="hazelcast:multimap:foo" />
</route>

...

Code Block
fromF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX)
.log("object...")
.choice()
	)
.log("object...")
.choice()
	.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
		.log("...added")
                .to("mock:added")
        //.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDEDENVICTED))
		        //        .log("...addedenvicted")
        //        .to("mock:addedenvicted")
        //.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ENVICTED)).isEqualTo(HazelcastConstants.REMOVED))
                .log("...removed")
        //        .logto("mock:removed"...envicted")
        .otherwise()
        //        .to("mock:envicted")
        .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.REMOVED))
                .log("...removed")
                .to("mock:removed")
        .otherwise()
                .log("fail!");

...

log("fail!");

Header Variables inside the response message:

Name

Type

Description

hazelcast.listener.time

Long

time of the event in millis

hazelcast.listener.type

String

the map consumer sets here "cachelistener"

hazelcast.listener.action

String

type of event - here added and removed (and soon envicted)

hazelcast.objectId

String

the oid of the object

hazelcast.cache.name

String

the name of the cache - e.g. "foo"

hazelcast.cache.type

String

the type of the cache - here multimap

Eviction will be added as feature, soon (this is a Hazelcast issue).

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

hazelcast.listener.time CamelHazelcastListenerTime

Long

time of the event in millis Available as of Version 2.8

CamelHazelcastListenerType hazelcast.listener.type

String

the map consumer sets here "cachelistener" Available as of Version 2.8

CamelHazelcastListenerAction hazelcast.listener.action

String

type of event - here added and removed (and soon envicted) Available as of Version 2.8

CamelHazelcastObjectId hazelcast.objectId

String

the oid of the object Available as of Version 2.8

CamelHazelcastCacheName hazelcast.cache.name

String

the name of the cache - e.g. "foo" Available as of Version 2.8

CamelHazelcastCacheType hazelcast.cache.type

String

the type of the cache - here multimap

...

Available as of Version 2.8

Anchor
queue
queue

Usage of Queue

...

Code Block
from("direct:add")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.ADD_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
Sample for put:
Code Block
from("direct:put")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);

...

Code Block
from("direct:add")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.ADD_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX);
Sample for get:
Code Block
from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
.toF("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX)
.to("seda:out");

...

An atomic number is an object that simply provides a grid wide number (long). The operations for this producer are setvalue (set the number with a given value)producer are setvalue (set the number with a given value), get, increase (+1), decrease (-1) and destroy.

Header Variables for the request message:

Name

Type

Description

hazelcast.operation.type

String

valid values are: setvalue, get, increase

...

, decrease

...

, destroy

Warning

Header variables have changed in Camel 2.8

...

Name

Type

Description

hazelcast.operation.type

String

valid values are: setvalue, get, increase, decrease, destroy Available as of Camel version 2.8

Sample for set:

Java DSL:

Code Block
from("direct:set")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.SETVALUE_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

...

Code Block
<route>
	<from uri="direct:set" /:set" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>setvalue</constant>
	</setHeader>
	<to uri="hazelcast:atomicvalue:foo" />
</route>

Provide the value to set inside the message body (here the value is 10): template.sendBody("direct:set", 10);

Sample for get:

Java DSL:

Code Block
from("direct:get")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);

...

Code Block
<route>
	<from uri="direct:get" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>get</constant>
	</setHeader>
	<to uri="hazelcast:atomicvalue:foo" />
</route>

...

Code Block
<route>
	<from uri="direct:increment" /increment" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>increment</constant>
	</setHeader>
	<to uri="hazelcast:atomicvalue:foo" />
</route>

...

Code Block
<route>
	<from uri="direct:decrement" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>decrement</constant>
	</setHeader>
	<to uri="hazelcast:atomicvalue:foo" />
</route>

...

Code Block
<route>
	<from uri="direct:destroy" />
        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
	<setHeader headerName="hazelcast.operation.type">
		<constant>destroy</constant>
	</setHeader>
	<to uri="hazelcast:atomicvalue:foo" />
</route>

...

Code Block
fromF("hazelcast:%sfoo", HazelcastConstants.INSTANCE_PREFIX)
.log("instance...")
.choice()
	.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
		.log("...added")
		.to("mock:added")
	.otherwise()
		.log("...removed")
		.to("mock:removed")
		.to("mock:added")
	.otherwise()
		.log("...removed")
		.to("mock:removed");

Each event provides the following information inside the message header:

...

;

Each event provides the following information inside the message header:

Header Variables inside the response message:

Name

Type

Description

hazelcast.listener.time

Long

time of the event in millis

hazelcast.listener.type

String

the map consumer sets here "instancelistener"

hazelcast.listener.action

String

type of event - here added or removed

hazelcast.instance.host

String

host name of the instance

hazelcast.instance.port

Integer

port number of the instance

Warning

Header variables have changed in Camel 2.8

Name

Type

Description

hazelcast.listener.time CamelHazelcastListenerTime

Long

time of the event in millis Available as of Version 2.8

CamelHazelcastListenerType hazelcast.listener.type

String

the map consumer sets here "instancelistener" Available as of Version 2.8

CamelHazelcastListenerActionn hazelcast.listener.action

String

type of event - here added or removed. Available as of Version 2.8

CamelHazelcastInstanceHost hazelcast.instance.host

String

host name of the instance hazelcast.instance.port Available as of Version 2.8

CamelHazelcastInstancePort

Integer

port number of the instance Available as of Version 2.8