Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: documentation for queue, list, seda added.

...

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

...

  1. #cluster support (instance)

Anchor
map
map

Usage of Map

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

...

Code Block
from(String.format("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")

...

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

atomic number

Warning

There is no consumer for this component!

Anchor
queue
queue

Usage of Queue

Queue producer – to(“hazelcast:queue:foo”)

The queue producer provides 6 operations (add, put, poll, peek, offer, removevalue).

Sample for add:
Code Block

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

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

from("direct:poll")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.POLL_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX));
Sample for peek:
Code Block

from("direct:peek")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PEEK_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX));
Sample for offer:
Code Block

from("direct:offer")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.OFFER_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX));
Sample for removevalue:
Code Block

from("direct:removevalue")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX));

Queue consumer – from(“hazelcast:queue:foo”)

The queue consumer provides 2 operations (add, remove).

Code Block

from(String.format("hazelcast:%smm", HazelcastConstants.QUEUE_PREFIX))
   .log("object...")
   .choice()
	.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
        	.log("...added")
		.to("mock:added")
	.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.REMOVED))
		.log("...removed")
		.to("mock:removed")
	.otherwise()
		.log("fail!");

Anchor
list
list

Usage of List

List producer – to(“hazelcast:list:foo”)

The list producer provides 4 operations (add, set, get, removevalue).

Sample for add:
Code Block

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

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

from("direct:set")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.SETVALUE_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX));
Sample for removevalue:
Code Block

from("direct:removevalue")
.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION))
.to(String.format("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX));
Warning

Please note that set,get and removevalue and not yet supported by hazelcast, will be added in the future..

List consumer – from(“hazelcast:list:foo”)

The list consumer provides 2 operations (add, remove).

Code Block

from(String.format("hazelcast:%smm", HazelcastConstants.LIST_PREFIX))
	.log("object...")
	.choice()
		.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.ADDED))
			.log("...added")
                        .to("mock:added")
		.when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.REMOVED))
			.log("...removed")
                        .to("mock:removed")
                .otherwise()
                        .log("fail!");

Anchor
seda
seda

Usage of SEDA

SEDA component differs from the rest components provided. It implements a work-queue in order to support asynchronous SEDA architectures, similar to the core "SEDA" component.

SEDA producer – to(“hazelcast:seda:foo”)

The SEDA producer provides no operations. You only send data to the specified queue.

Java DSL :

Code Block

from("direct:foo")
.to("hazelcast:seda:foo");

Spring DSL :

Code Block

<route>
   <from uri="direct:start" />
   <to uri="hazelcast:seda:foo" />
</route>

SEDA consumer – from(“hazelcast:seda:foo”)

The SEDA consumer provides no operations. You only retrieve data from the specified queue.

Java DSL :

Code Block

from("hazelcast:seda:foo")
.to("mock:result");

Spring DSL:

Code Block

<route>
  <from uri="hazelcast:seda:foo" />
  <to uri="mock:result" />
</route>

Anchor
atomicnumber
atomicnumber

Usage of Atomic Number

Warning

There is no consumer for this endpoint!

atomic number producer atomic number producer - to("hazelcast:atomicnumber:foo")

...

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))
.to(String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX));

...

Code Block
<route>
	<from uri="direct:destroy" />
	<setHeader headerName="hazelcast.operation.type">
		<constant>destroy</constant>
	</setHeader>
	<to uri="hazelcast:atomicvalue:foo" />
</route>

Anchor
cluster
cluster

cluster support

Warning

This endpoint provides no producer!

...