You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/04/02 16:30:31 UTC

[1/4] camel git commit: Added camel-guava-eventbus docs to gitbook

Repository: camel
Updated Branches:
  refs/heads/master 9f618a28a -> 2c153ed4b


Added camel-guava-eventbus docs to gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2c07a23f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2c07a23f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2c07a23f

Branch: refs/heads/master
Commit: 2c07a23ffa99a136a50a31286ea3c3cbd1ec2c7c
Parents: 9f618a2
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sat Apr 2 15:02:25 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sat Apr 2 15:02:25 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/guava-eventbus.adoc           | 203 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 204 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2c07a23f/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
----------------------------------------------------------------------
diff --git a/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc b/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
new file mode 100644
index 0000000..11cc8ea
--- /dev/null
+++ b/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
@@ -0,0 +1,203 @@
+[[GuavaEventBus-GuavaEventBusComponent]]
+Guava EventBus Component
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Available since Camel 2.10.0*
+
+The
+http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/eventbus/package-summary.html[Google
+Guava EventBus] allows publish-subscribe-style communication between
+components without requiring the components to explicitly register with
+one another (and thus be aware of each other). The *guava-eventbus:*
+component provides integration bridge between Camel and
+http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/eventbus/package-summary.html[Google
+Guava EventBus] infrastructure. With the latter component, messages
+exchanged with the Guava `EventBus` can be transparently forwarded to
+the Camel routes. EventBus component allows also to route body of Camel
+exchanges to the Guava `EventBus`.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-guava-eventbus</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[GuavaEventBus-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+--------------------------------
+guava-eventbus:busName[?options]
+--------------------------------
+
+Where *busName* represents the name of the
+`com.google.common.eventbus.EventBus` instance located in the Camel
+registry.
+
+[[GuavaEventBus-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The Guava EventBus component supports 2 options which are listed below.
+
+[width="100%",cols="2s,1m,8",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| eventBus | EventBus | To use the given Guava EventBus instance
+| listenerInterface | Class<?> | The interface with method(s) marked with the Subscribe annotation. Dynamic proxy will be created over the interface so it could be registered as the EventBus listener. Particularly useful when creating multi-event listeners and for handling DeadEvent properly. This option cannot be used together with eventClass option.
+|=======================================================================
+// component options: END
+
+// endpoint options: START
+The Guava EventBus component supports 7 endpoint options which are listed below:
+
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| eventBusRef | common |  | String | To lookup the Guava EventBus from the registry with the given name
+| eventClass | common |  | Class<?> | If used on the consumer side of the route will filter events received from the EventBus to the instances of the class and superclasses of eventClass. Null value of this option is equal to setting it to the java.lang.Object i.e. the consumer will capture all messages incoming to the event bus. This option cannot be used together with listenerInterface option.
+| listenerInterface | common |  | Class<?> | The interface with method(s) marked with the Subscribe annotation. Dynamic proxy will be created over the interface so it could be registered as the EventBus listener. Particularly useful when creating multi-event listeners and for handling DeadEvent properly. This option cannot be used together with eventClass option.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+// endpoint options: END
+
+
+[[GuavaEventBus-Usage]]
+Usage
+^^^^^
+
+Using `guava-eventbus` component on the consumer side of the route will
+capture messages sent to the Guava `EventBus` and forward them to the
+Camel route. Guava EventBus consumer processes incoming messages
+http://camel.apache.org/asynchronous-routing-engine.html[asynchronously].
+
+[source,java]
+-------------------------------------------------------
+SimpleRegistry registry = new SimpleRegistry();
+EventBus eventBus = new EventBus();
+registry.put("busName", eventBus);
+CamelContext camel = new DefaultCamelContext(registry);
+
+from("guava-eventbus:busName").to("seda:queue");
+
+eventBus.post("Send me to the SEDA queue.");
+-------------------------------------------------------
+
+Using `guava-eventbus` component on the producer side of the route will
+forward body of the Camel exchanges to the Guava `EventBus` instance.
+
+[source,java]
+----------------------------------------------------------------------
+SimpleRegistry registry = new SimpleRegistry();
+EventBus eventBus = new EventBus();
+registry.put("busName", eventBus);
+CamelContext camel = new DefaultCamelContext(registry);
+
+from("direct:start").to("guava-eventbus:busName");
+
+ProducerTemplate producerTemplate = camel.createProducerTemplate();
+producer.sendBody("direct:start", "Send me to the Guava EventBus.");
+
+eventBus.register(new Object(){
+  @Subscribe
+  public void messageHander(String message) {
+    System.out.println("Message received from the Camel: " + message);
+  }
+});
+----------------------------------------------------------------------
+
+[[GuavaEventBus-DeadEventconsiderations]]
+DeadEvent considerations
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Keep in mind that due to the limitations caused by the design of the
+Guava EventBus, you cannot specify event class to be received by the
+listener without creating class annotated with `@Subscribe` method. This
+limitation implies that endpoint with `eventClass` option specified
+actually listens to all possible events (`java.lang.Object`) and filter
+appropriate messages programmatically at runtime. The snipped below
+demonstrates an appropriate excerpt from the Camel code base.
+
+[source,java]
+----------------------------------------------------------------------------
+@Subscribe
+public void eventReceived(Object event) {
+  if (eventClass == null || eventClass.isAssignableFrom(event.getClass())) {
+    doEventReceived(event);
+...
+----------------------------------------------------------------------------
+
+This drawback of this approach is that `EventBus` instance used by Camel
+will never generate `com.google.common.eventbus.DeadEvent`
+notifications. If you want Camel to listen only to the precisely
+specified event (and therefore enable `DeadEvent` support), use
+`listenerInterface` endpoint option. Camel will create dynamic proxy
+over the interface you specify with the latter option and listen only to
+messages specified by the interface handler methods. The example of the
+listener interface with single method handling only `SpecificEvent`
+instances is demonstrated below.
+
+[source,java]
+------------------------------------------
+package com.example;
+
+public interface CustomListener {
+
+  @Subscribe
+  void eventReceived(SpecificEvent event);
+
+}
+------------------------------------------
+
+The listener presented above could be used in the endpoint definition as
+follows.
+
+[source,java]
+---------------------------------------------------------------------------------------------
+from("guava-eventbus:busName?listenerInterface=com.example.CustomListener").to("seda:queue");
+---------------------------------------------------------------------------------------------
+
+[[GuavaEventBus-Consumingmultipletypeofevents]]
+Consuming multiple type of events
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+In order to define multiple type of events to be consumed by Guava
+EventBus consumer use `listenerInterface` endpoint option, as listener
+interface could provide multiple methods marked with the `@Subscribe`
+annotation.
+
+[source,java]
+------------------------------------------------
+package com.example;
+
+public interface MultipleEventsListener {
+
+  @Subscribe
+  void someEventReceived(SomeEvent event);
+
+  @Subscribe
+  void anotherEventReceived(AnotherEvent event);
+
+}
+------------------------------------------------
+
+The listener presented above could be used in the endpoint definition as
+follows.
+
+[source,java]
+-----------------------------------------------------------------------------------------------------
+from("guava-eventbus:busName?listenerInterface=com.example.MultipleEventsListener").to("seda:queue");
+-----------------------------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/2c07a23f/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index cfd9568..14b03be 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -143,6 +143,7 @@
     * [Grape](grape.adoc)
     * [Groovy](groovy.adoc)
         * [Groovy DSL](groovy-dsl.adoc)
+    * [Guava Eventbus](guava-eventbus.adoc)
     * [Ironmq](ironmq.adoc)
     * [JMS](jms.adoc)
     * [JMX](jmx.adoc)


[2/4] camel git commit: Added camel-guice docs to gitbook

Posted by ac...@apache.org.
Added camel-guice docs to gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae4ebd33
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae4ebd33
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae4ebd33

Branch: refs/heads/master
Commit: ae4ebd3333ac42a4bd66e4306f7acaab8170dae1
Parents: 2c07a23
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sat Apr 2 15:11:31 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sat Apr 2 15:11:31 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/guava-eventbus.adoc           |   4 +
 components/camel-guice/src/main/docs/guice.adoc | 161 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 3 files changed, 166 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ae4ebd33/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
----------------------------------------------------------------------
diff --git a/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc b/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
index 11cc8ea..edda987 100644
--- a/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
+++ b/components/camel-guava-eventbus/src/main/docs/guava-eventbus.adoc
@@ -47,9 +47,12 @@ Options
 ^^^^^^^
 
 
+
 // component options: START
 The Guava EventBus component supports 2 options which are listed below.
 
+
+
 [width="100%",cols="2s,1m,8",options="header"]
 |=======================================================================
 | Name | Java Type | Description
@@ -58,6 +61,7 @@ The Guava EventBus component supports 2 options which are listed below.
 |=======================================================================
 // component options: END
 
+
 // endpoint options: START
 The Guava EventBus component supports 7 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/ae4ebd33/components/camel-guice/src/main/docs/guice.adoc
----------------------------------------------------------------------
diff --git a/components/camel-guice/src/main/docs/guice.adoc b/components/camel-guice/src/main/docs/guice.adoc
new file mode 100644
index 0000000..a1d9eae
--- /dev/null
+++ b/components/camel-guice/src/main/docs/guice.adoc
@@ -0,0 +1,161 @@
+[[Guice-CamelGuice]]
+Camel Guice
+~~~~~~~~~~~
+
+We have support for http://code.google.com/p/google-guice/[Google Guice]
+as a dependency injection framework.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-guice</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[Guice-DependencyInjectingCamelwithGuice]]
+Dependency Injecting Camel with Guice
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The http://camel.apache.org/maven/current/camel-guice/apidocs/org/apache/camel/guice/GuiceCamelContext.html[GuiceCamelContext]
+is designed to work nicely inside Guice. You then need to bind it using
+some Guice Module.
+
+The camel-guice library comes with a number of reusable Guice Modules
+you can use if you wish - or you can bind the GuiceCamelContext yourself
+in your own module.
+
+* http://camel.apache.org/maven/current/camel-guice/apidocs/org/apache/camel/guice/CamelModule.html[CamelModule]
+is the base module which binds the GuiceCamelContext but leaves it up
+you to bind the RouteBuilder instances
+* http://camel.apache.org/maven/current/camel-guice/apidocs/org/apache/camel/guice/CamelModuleWithRouteTypes.html[CamelModuleWithRouteTypes]
+extends CamelModule so that in the constructor of the module you specify
+the RouteBuilder classes or instances to use
+* http://camel.apache.org/maven/current/camel-guice/apidocs/org/apache/camel/guice/CamelModuleWithMatchingRoutes.html[CamelModuleWithMatchingRoutes]
+extends CamelModule so that all bound RouteBuilder instances will be
+injected into the CamelContext or you can supply an optional Matcher to
+find RouteBuilder instances matching some kind of predicate.
+
+So you can specify the exact link:routebuilder.html[RouteBuilder]
+instances you want
+
+[source,java]
+-------------------------------------------------------------------------------------------------------------------------
+Injector injector = Guice.createInjector(new CamelModuleWithRouteTypes(MyRouteBuilder.class, AnotherRouteBuilder.class));
+// if required you can lookup the CamelContext
+CamelContext camelContext = injector.getInstance(CamelContext.class);
+-------------------------------------------------------------------------------------------------------------------------
+
+Or inject them all
+
+[source,java]
+--------------------------------------------------------------------------
+Injector injector = Guice.createInjector(new CamelModuleWithRouteTypes());
+// if required you can lookup the CamelContext
+CamelContext camelContext = injector.getInstance(CamelContext.class);
+--------------------------------------------------------------------------
+
+You can then use Guice in the usual way to inject the route instances or
+any other dependent objects.
+
+[[Guice-BootstrappingwithJNDI]]
+Bootstrapping with JNDI
+^^^^^^^^^^^^^^^^^^^^^^^
+
+A common pattern used in J2EE is to bootstrap your application or root
+objects by looking them up in JNDI. This has long been the approach when
+working with JMS for example - looking up the JMS ConnectionFactory in
+JNDI for example.
+
+You can follow a similar pattern with Guice using the
+http://code.google.com/p/guiceyfruit/wiki/GuiceyJndi[GuiceyFruit JNDI
+Provider] which lets you bootstrap Guice from a *jndi.properties* file
+which can include the Guice Modules to create along with environment
+specific properties you can inject into your modules and objects.
+
+If the *jndi.properties* is conflict with other component, you can
+specify the jndi properties file name in the Guice Main with option -j
+or -jndiProperties with the properties file location to let Guice Main
+to load right jndi properties file.
+
+[[Guice-ConfiguringComponent,EndpointorRouteBuilderinstances]]
+Configuring Component, Endpoint or RouteBuilder instances
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+You can use link:guice.html[Guice] to dependency inject whatever objects
+you need to create, be it an link:endpoint.html[Endpoint],
+link:component.html[Component], link:routebuilder.html[RouteBuilder] or
+arbitrary link:bean-integration.html[bean used within a route].
+
+The easiest way to do this is to create your own Guice Module class
+which extends one of the above module classes and add a provider method
+for each object you wish to create. A provider method is annotated with
+*@Provides* as follows
+
+[source,java]
+-----------------------------------------------------------------------------------
+public class MyModule extends CamelModuleWithMatchingRoutes {
+
+    @Provides
+    @JndiBind("jms")
+    JmsComponent jms(@Named("activemq.brokerURL") String brokerUrl) {
+        return JmsComponent.jmsComponent(new ActiveMQConnectionFactory(brokerUrl));
+    }
+}
+-----------------------------------------------------------------------------------
+
+You can optionally annotate the method with *@JndiBind* to bind the
+object to JNDI at some name if the object is a component, endpoint or
+bean you wish to refer to by name in your routes.
+
+You can inject any environment specific properties (such as URLs,
+machine names, usernames/passwords and so forth) from the
+jndi.properties file easily using the *@Named* annotation as shown
+above. This allows most of your configuration to be in Java code which
+is typesafe and easily refactorable - then leaving some properties to be
+environment specific (the jndi.properties file) which you can then
+change based on development, testing, production etc.
+
+[[Guice-CreatingmultipleRouteBuilderinstancespertype]]
+Creating multiple RouteBuilder instances per type
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+It is sometimes useful to create multiple instances of a particular
+link:routebuilder.html[RouteBuilder] with different configurations.
+
+To do this just create multiple provider methods for each configuration;
+or create a single provider method that returns a collection of
+RouteBuilder instances.
+
+For example
+
+[source,java]
+----------------------------------------------------------------------------------------------------------
+import org.apache.camel.guice.CamelModuleWithMatchingRoutes;
+import com.google.common.collect.Lists;
+
+public class MyModule extends CamelModuleWithMatchingRoutes {
+
+    @Provides
+    @JndiBind("foo")
+    Collection<RouteBuilder> foo(@Named("fooUrl") String fooUrl) {
+        return Lists.newArrayList(new MyRouteBuilder(fooUrl), new MyRouteBuilder("activemq:CheeseQueue"));
+    }
+}
+----------------------------------------------------------------------------------------------------------
+
+[[Guice-SeeAlso]]
+See Also
+^^^^^^^^
+
+* there are a number of link:examples.html[Examples] you can look at to
+see Guice and Camel being used such as link:guice-jms-example.html[Guice
+JMS Example]
+* link:guice-maven-plugin.html[Guice Maven Plugin] for running your
+Guice based routes via Maven
+

http://git-wip-us.apache.org/repos/asf/camel/blob/ae4ebd33/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 14b03be..8c260ef 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -144,6 +144,7 @@
     * [Groovy](groovy.adoc)
         * [Groovy DSL](groovy-dsl.adoc)
     * [Guava Eventbus](guava-eventbus.adoc)
+    * [Guice](guice.adoc)
     * [Ironmq](ironmq.adoc)
     * [JMS](jms.adoc)
     * [JMX](jmx.adoc)


[4/4] camel git commit: Added camel-hazelcast docs to gitbook

Posted by ac...@apache.org.
Added camel-hazelcast docs to gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2c153ed4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2c153ed4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2c153ed4

Branch: refs/heads/master
Commit: 2c153ed4b9f01b0bcf9443b7f31e146f31a14ddb
Parents: 893081c
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sat Apr 2 16:29:54 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sat Apr 2 16:29:54 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/hazelcast.adoc                | 1394 ++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |    1 +
 2 files changed, 1395 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2c153ed4/components/camel-hazelcast/src/main/docs/hazelcast.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hazelcast/src/main/docs/hazelcast.adoc b/components/camel-hazelcast/src/main/docs/hazelcast.adoc
new file mode 100644
index 0000000..a11e611
--- /dev/null
+++ b/components/camel-hazelcast/src/main/docs/hazelcast.adoc
@@ -0,0 +1,1394 @@
+[[HazelcastComponent-HazelcastComponent]]
+Hazelcast Component
+~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.7*
+
+The *hazelcast:* component allows you to work with the
+http://www.hazelcast.com[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/docs.jsp[http://www.hazelcast.com/docs.jsp].
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,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>
+------------------------------------------------------------
+
+[[HazelcastComponent-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+-------------------------------------------------------------------------------------------------------------------------
+hazelcast:[ map | multimap | queue | topic | seda | set | atomicvalue | instance | list | ringbuffer]:cachename[?options]
+-------------------------------------------------------------------------------------------------------------------------
+
+* Topic support is available as of Camel 2.15. *
+
+
+* RingBuffer support is available as of Camel 2.16. *
+
+[[HazelcastComponent-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The Hazelcast component supports 1 options which are listed below.
+
+
+
+[width="100%",cols="2s,1m,8",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| hazelcastInstance | HazelcastInstance | The hazelcast instance reference which can be used for hazelcast endpoint. If you don't specify the instance reference camel use the default hazelcast instance from the camel-hazelcast instance.
+|=======================================================================
+// component options: END
+
+
+
+// endpoint options: START
+The Hazelcast component supports 13 endpoint options which are listed below:
+
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| command | common |  | HazelcastCommand | *Required* What operation to perform.
+| cacheName | common |  | String | *Required* The name of the cache
+| defaultOperation | common |  | int | To specify a default operation to use if no operation header has been provided.
+| hazelcastInstance | common |  | HazelcastInstance | The hazelcast instance reference which can be used for hazelcast endpoint.
+| hazelcastInstanceName | common |  | String | The hazelcast instance reference name which can be used for hazelcast endpoint. If you don't specify the instance reference camel use the default hazelcast instance from the camel-hazelcast instance.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+| concurrentConsumers | seda | 1 | int | To use concurrent consumers polling from the SEDA queue.
+| pollTimeout | seda | 1000 | int | The timeout used when consuming from the SEDA queue. When a timeout occurs the consumer can check whether it is allowed to continue running. Setting a lower value allows the consumer to react more quickly upon shutdown.
+| transacted | seda | false | boolean | If set to true then the consumer runs in transaction mode where the messages in the seda queue will only be removed if the transaction commits which happens when the processing is complete.
+| transferExchange | seda | false | boolean | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped.
+|=======================================================================
+// endpoint options: END
+
+
+[[HazelcastComponent-Sections]]
+Sections
+^^^^^^^^
+
+1.  Usage of link:hazelcast-component.html[#map]
+2.  Usage of link:hazelcast-component.html[#multimap]
+3.  Usage of link:hazelcast-component.html[#queue]
+4.  Usage of link:hazelcast-component.html[#topic]
+5.  Usage of link:hazelcast-component.html[#list]
+6.  Usage of link:hazelcast-component.html[#seda]
+7.  Usage of link:hazelcast-component.html[atomic number]
+8.  Usage of link:hazelcast-component.html[#cluster] support (instance)
+9.  Usage of link:hazelcast-component.html[#replicatedmap] 
+10. Usage of link:hazelcast-component.html[#ringbuffer] 
+
+[[HazelcastComponent-UsageofMap]]
+Usage of Map
+^^^^^^^^^^^^
+
+[[HazelcastComponent-mapcacheproducer-to-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:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+|`CamelHazelcastOperationType` |`String` |valid values are: put, delete, get, update, query, getAll, putIfAbsent, clear. 
+
+|`CamelHazelcastObjectId` |`String` |the object id to store / find your object inside the cache (not needed for the query operation)
+|=======================================================================
+
+You can call the samples with:
+
+[source,java]
+-------------------------------------------------------------------------------------------------------------------
+template.sendBodyAndHeader("direct:[put|get|update|delete|query]", "my-foo", HazelcastConstants.OBJECT_ID, "4711");
+-------------------------------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforput:]]
+Sample for *put*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:put")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforget:]]
+Sample for *get*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:get")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
+.to("seda:out");
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforupdate:]]
+Sample for *update*:
+
+Java DSL:
+
+[source,java]
+---------------------------------------------------------------------------------------
+from("direct:update")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.UPDATE_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);
+---------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Samplefordelete:]]
+Sample for *delete*:
+
+Java DSL:
+
+[source,java]
+---------------------------------------------------------------------------------------
+from("direct:delete")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DELETE_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX);
+---------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforquery]]
+Sample for *query*
+
+Java DSL:
+
+[source,java]
+--------------------------------------------------------------------------------------
+from("direct:query")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.QUERY_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.MAP_PREFIX)
+.to("seda:out");
+--------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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.
+
+[source,java]
+-------------------------------------------------------------------------------
+String q1 = "bar > 1000";
+template.sendBodyAndHeader("direct:query", null, HazelcastConstants.QUERY, q1);
+-------------------------------------------------------------------------------
+
+[[HazelcastComponent-mapcacheconsumer-from-map]]
+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:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastListenerTime` |`Long` |time of the event in millis
+
+|`CamelHazelcastListenerType` |`String` |the map consumer sets here "cachelistener"
+
+|`CamelHazelcastListenerAction` |`String` |type of event - here *added*, *updated*, *envicted* and *removed*.
+
+|`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:
+
+[source,java]
+--------------------------------------------------------------------------------------------
+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!");
+--------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-UsageofMultiMap]]
+Usage of Multi Map
+^^^^^^^^^^^^^^^^^^
+
+[[HazelcastComponent-multimapcacheproducer-to-multimap]]
+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:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastOperationType` |`String` |valid values are: put, get, removevalue, delete *From Camel 2.16:* clear.
+
+|`CamelHazelcastObjectId` |`String` |the object id to store / find your object inside the cache
+|=======================================================================
+
+[[HazelcastComponent-Sampleforput:.1]]
+Sample for *put*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:put")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))
+.to(String.format("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX));
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforremovevalue:]]
+Sample for *removevalue*:
+
+Java DSL:
+
+[source,java]
+--------------------------------------------------------------------------------------------
+from("direct:removevalue")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX);
+--------------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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.
+
+[[HazelcastComponent-Sampleforget:.1]]
+Sample for *get*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:get")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX)
+.to("seda:out");
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<route>
+    <from uri="direct:get" />
+    <log message="get.."/>
+        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
+    <setHeader headerName="hazelcast.operation.type">
+        <constant>get</constant>
+    </setHeader>
+    <to uri="hazelcast:multimap:foo" />
+    <to uri="seda:out" />
+</route>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Samplefordelete:.1]]
+Sample for *delete*:
+
+Java DSL:
+
+[source,java]
+---------------------------------------------------------------------------------------
+from("direct:delete")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DELETE_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_PREFIX);
+---------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<route>
+    <from uri="direct: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>
+-----------------------------------------------------------------------------------------------
+
+you can call them in your test class with:
+
+[source,java]
+------------------------------------------------------------------------------------------------------------------
+template.sendBodyAndHeader("direct:[put|get|removevalue|delete]", "my-foo", HazelcastConstants.OBJECT_ID, "4711");
+------------------------------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-multimapcacheconsumer-from-multimap]]
+multimap cache consumer - from("hazelcast:multimap:foo")
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+For the multimap cache this component provides the same listeners /
+variables as for the map cache consumer (except the update and enviction
+listener). The only difference is the *multimap* prefix inside the URI.
+Here is a sample:
+
+[source,java]
+--------------------------------------------------------------------------------------------------
+fromF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_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.REMOVED))
+                .log("...removed")
+                .to("mock:removed")
+        .otherwise()
+                .log("fail!");
+--------------------------------------------------------------------------------------------------
+
+Header Variables inside the response message:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastListenerTime` |`Long` |time of the event in millis
+
+|`CamelHazelcastListenerType` |`String` |the map consumer sets here "cachelistener"
+
+|`CamelHazelcastListenerAction` |`String` |type of event - here *added* and *removed* (and soon *envicted*)
+
+|`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 multimap
+|=======================================================================
+
+[[HazelcastComponent-UsageofQueue]]
+Usage of Queue
+^^^^^^^^^^^^^^
+
+[[HazelcastComponent-Queueproducer]]
+Queue producer – to(“hazelcast:queue:foo”)
+++++++++++++++++++++++++++++++++++++++++++
+
+The queue producer provides 6 operations (add, put, poll, peek, offer,
+removevalue).
+
+[[HazelcastComponent-Sampleforadd:]]
+Sample for *add*:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:add")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.ADD_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
+------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforput:.2]]
+Sample for *put*:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:put")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
+------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforpoll:]]
+Sample for *poll*:
+
+[source,java]
+-------------------------------------------------------------------------------------
+from("direct:poll")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.POLL_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
+-------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforpeek:]]
+Sample for *peek*:
+
+[source,java]
+-------------------------------------------------------------------------------------
+from("direct:peek")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PEEK_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
+-------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforoffer:]]
+Sample for *offer*:
+
+[source,java]
+--------------------------------------------------------------------------------------
+from("direct:offer")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.OFFER_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
+--------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforremovevalue:.1]]
+Sample for *removevalue*:
+
+[source,java]
+--------------------------------------------------------------------------------------------
+from("direct:removevalue")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX);
+--------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Queueconsumer]]
+Queue consumer – from(“hazelcast:queue:foo”)
+++++++++++++++++++++++++++++++++++++++++++++
+
+The queue consumer provides 2 operations (add, remove).
+
+[source,java]
+-------------------------------------------------------------------------------------------
+fromF("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!");
+-------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-topic]]
+
+[[HazelcastComponent-UsageofTopic]]
+Usage of Topic
+^^^^^^^^^^^^^^
+
+[[HazelcastComponent-Topicproducer]]
+Topic producer – to(“hazelcast:topic:foo”)
+++++++++++++++++++++++++++++++++++++++++++
+
+The topic producer provides only one operation (publish).
+
+[[HazelcastComponent-Sampleforpublish:]]
+Sample for *publish*:
+
+[source,java]
+----------------------------------------------------------------------------------------
+from("direct:add")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUBLISH_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.PUBLISH_OPERATION);
+----------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Topicconsumer]]
+Topic consumer – from(“hazelcast:topic:foo”)
+++++++++++++++++++++++++++++++++++++++++++++
+
+The topic consumer provides only one operation (received). This
+component is supposed to support multiple consumption as it's expected
+when it comes to topics so you are free to have as much consumers as you
+need on the same hazelcast topic.
+
+[source,java]
+--------------------------------------------------------------------------------------------
+fromF("hazelcast:%sfoo", HazelcastConstants.TOPIC_PREFIX)
+  .choice()
+    .when(header(HazelcastConstants.LISTENER_ACTION).isEqualTo(HazelcastConstants.RECEIVED))
+      .log("...message received")
+    .otherwise()
+      .log("...this should never have happened")
+--------------------------------------------------------------------------------------------
+
+ 
+
+[[HazelcastComponent-UsageofList]]
+Usage of List
+^^^^^^^^^^^^^
+
+[[HazelcastComponent-Listproducer]]
+List producer – to(“hazelcast:list:foo”)
+++++++++++++++++++++++++++++++++++++++++
+
+The list producer provides 4 operations (add, addAll, set, get,
+removevalue, removeAll, clear).
+
+[[HazelcastComponent-Sampleforadd:.1]]
+Sample for *add*:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:add")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.ADD_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX);
+------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforget:.2]]
+Sample for *get*:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:get")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX)
+.to("seda:out");
+------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforsetvalue:]]
+Sample for *setvalue*:
+
+[source,java]
+-----------------------------------------------------------------------------------------
+from("direct:set")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.SETVALUE_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX);
+-----------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforremovevalue:.2]]
+Sample for *removevalue*:
+
+[source,java]
+--------------------------------------------------------------------------------------------
+from("direct:removevalue")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.LIST_PREFIX);
+--------------------------------------------------------------------------------------------
+
+Note that *CamelHazelcastObjectIndex* header is used for indexing
+purpose.
+
+[[HazelcastComponent-Thelistconsumerprovides2operationsListconsumer]]
+The list consumer provides 2 operations (add, remove).List consumer – from(“hazelcast:list:foo”)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+fromF("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!");
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-UsageofSEDA]]
+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.
+
+[[HazelcastComponent-SEDAproducer]]
+SEDA producer – to(“hazelcast:seda:foo”)
+++++++++++++++++++++++++++++++++++++++++
+
+The SEDA producer provides no operations. You only send data to the
+specified queue.
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Default value |Description
+
+|`transferExchange` |`false` | if set to true the whole Exchange will be transfered. If
+header or body contains not serializable objects, they will be skipped.
+|=======================================================================
+
+Java DSL :
+
+[source,java]
+--------------------------
+from("direct:foo")
+.to("hazelcast:seda:foo");
+--------------------------
+
+Spring DSL :
+
+[source,java]
+----------------------------------
+<route>
+   <from uri="direct:start" />
+   <to uri="hazelcast:seda:foo" />
+</route>
+----------------------------------
+
+[[HazelcastComponent-SEDAconsumer]]
+SEDA consumer – from(“hazelcast:seda:foo”)
+++++++++++++++++++++++++++++++++++++++++++
+
+The SEDA consumer provides no operations. You only retrieve data from
+the specified queue.
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Default value |Description
+
+|`pollInterval` |`1000` |The timeout used when consuming from the SEDA queue. When a timeout
+occurs, the consumer can check whether it is allowed to continue
+running. Setting a lower value allows the consumer to react more quickly
+upon shutdown. (*deprecated* from Camel 2.15 onwards, use pollTimeout
+instead).
+
+|`pollTimeout` |1000 | The timeout used when consuming from the SEDA queue. When
+a timeout occurs, the consumer can check whether it is allowed to
+continue running. Setting a lower value allows the consumer to react
+more quickly upon shutdown.
+
+|`concurrentConsumers` |`1` |To use concurrent consumers polling from the SEDA queue.
+
+|`transferExchange` |`false`| if set to true the whole Exchange will be transfered. If
+header or body contains not serializable objects, they will be skipped.
+
+|`transacted` |`false`| if set to true then the consumer runs in transaction
+mode, where the messages in the seda queue will only be removed if the
+transaction commits, which happens when the processing is complete.
+|=======================================================================
+
+Java DSL :
+
+[source,java]
+--------------------------
+from("hazelcast:seda:foo")
+.to("mock:result");
+--------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------
+<route>
+  <from uri="hazelcast:seda:foo" />
+  <to uri="mock:result" />
+</route>
+-----------------------------------
+
+[[HazelcastComponent-UsageofAtomicNumber]]
+Usage of Atomic Number
+^^^^^^^^^^^^^^^^^^^^^^
+
+* There is no consumer for this endpoint! *
+
+[[HazelcastComponent-atomicnumberproducer]]
+atomic number producer - to("hazelcast:atomicnumber:foo")
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+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), get, increase (+1), decrease (-1) and destroy.
+
+Header Variables for the request message:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastOperationType` |`String` |valid values are: setvalue, get, increase, decrease, destroy 
+|=======================================================================
+
+[[HazelcastComponent-Sampleforset:]]
+Sample for *set*:
+
+Java DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------
+from("direct:set")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.SETVALUE_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);
+-----------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<route>
+    <from uri="direct: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);`
+
+[[HazelcastComponent-Sampleforget:.3]]
+Sample for *get*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:get")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+You can get the number with
+`long body = template.requestBody("direct:get", null, Long.class);`.
+
+[[HazelcastComponent-Sampleforincrement:]]
+Sample for *increment*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------------
+from("direct:increment")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.INCREMENT_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);
+------------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<route>
+    <from uri="direct: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>
+-----------------------------------------------------------------------------------------------
+
+The actual value (after increment) will be provided inside the message
+body.
+
+[[HazelcastComponent-Samplefordecrement:]]
+Sample for *decrement*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------------
+from("direct:decrement")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DECREMENT_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);
+------------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+The actual value (after decrement) will be provided inside the message
+body.
+
+[[HazelcastComponent-Samplefordestroy]]
+Sample for *destroy*
+
+Java DSL:
+
+[source,java]
+----------------------------------------------------------------------------------------
+from("direct:destroy")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DESTROY_OPERATION))
+.toF("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX);
+----------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-clustersupport]]
+cluster support
+^^^^^^^^^^^^^^^
+
+* This endpoint provides no producer! *
+
+[[HazelcastComponent-instanceconsumer-from]]
+instance consumer - from("hazelcast:instance:foo")
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Hazelcast makes sense in one single "server node", but it's extremly
+powerful in a clustered environment. The instance consumer fires if a
+new cache instance will join or leave the cluster.
+
+Here's a sample:
+
+[source,java]
+-----------------------------------------------------------------------------------------
+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");
+-----------------------------------------------------------------------------------------
+
+Each event provides the following information inside the message header:
+
+Header Variables inside the response message:
+
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastListenerTime` |`Long` |time of the event in millis
+
+|`CamelHazelcastListenerType` |`String` |the map consumer sets here "instancelistener"
+
+|`CamelHazelcastListenerAction` |`String` |type of event - here *added* or *removed*.
+
+|`CamelHazelcastInstanceHost` |`String` | host name of the instance
+
+|`CamelHazelcastInstancePort` |`Integer` |port number of the instance
+|=======================================================================
+
+[[HazelcastComponent-Usinghazelcastreference]]
+Using hazelcast reference
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+[[HazelcastComponent-Byitsname]]
+By its name
++++++++++++
+
+[source,xml]
+--------------------------------------------------------------------------------------------------------
+<bean id="hazelcastLifecycle" class="com.hazelcast.core.LifecycleService"
+      factory-bean="hazelcastInstance" factory-method="getLifecycleService"
+      destroy-method="shutdown" />
+
+<bean id="config" class="com.hazelcast.config.Config">
+    <constructor-arg type="java.lang.String" value="HZ.INSTANCE" />
+</bean>
+
+<bean id="hazelcastInstance" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance">
+    <constructor-arg type="com.hazelcast.config.Config" ref="config"/>
+</bean>
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route id="testHazelcastInstanceBeanRefPut">
+        <from uri="direct:testHazelcastInstanceBeanRefPut"/>
+        <setHeader headerName="CamelHazelcastOperationType">
+            <constant>put</constant>
+        </setHeader>
+        <to uri="hazelcast:map:testmap?hazelcastInstanceName=HZ.INSTANCE"/>
+    </route>
+
+    <route id="testHazelcastInstanceBeanRefGet">
+        <from uri="direct:testHazelcastInstanceBeanRefGet" />
+        <setHeader headerName="CamelHazelcastOperationType">
+            <constant>get</constant>
+        </setHeader>
+        <to uri="hazelcast:map:testmap?hazelcastInstanceName=HZ.INSTANCE"/>
+        <to uri="seda:out" />
+    </route>
+</camelContext>
+--------------------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Byinstance]]
+By instance
++++++++++++
+
+[source,xml]
+------------------------------------------------------------------------------
+<bean id="hazelcastInstance" class="com.hazelcast.core.Hazelcast"
+      factory-method="newHazelcastInstance" />
+<bean id="hazelcastLifecycle" class="com.hazelcast.core.LifecycleService"
+      factory-bean="hazelcastInstance" factory-method="getLifecycleService"
+      destroy-method="shutdown" />
+
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route id="testHazelcastInstanceBeanRefPut">
+        <from uri="direct:testHazelcastInstanceBeanRefPut"/>
+        <setHeader headerName="CamelHazelcastOperationType">
+            <constant>put</constant>
+        </setHeader>
+        <to uri="hazelcast:map:testmap?hazelcastInstance=#hazelcastInstance"/>
+    </route>
+
+    <route id="testHazelcastInstanceBeanRefGet">
+        <from uri="direct:testHazelcastInstanceBeanRefGet" />
+        <setHeader headerName="CamelHazelcastOperationType">
+            <constant>get</constant>
+        </setHeader>
+        <to uri="hazelcast:map:testmap?hazelcastInstance=#hazelcastInstance"/>
+        <to uri="seda:out" />
+    </route>
+</camelContext>
+------------------------------------------------------------------------------
+
+[[HazelcastComponent-PublishinghazelcastinstanceasanOSGIservice]]
+Publishing hazelcast instance as an OSGI service
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If operating in an OSGI container and you would want to use one instance
+of hazelcast across all bundles in the same container. You can publish
+the instance as an OSGI service and bundles using the cache al need is
+to reference the service in the hazelcast endpoint.
+
+[[HazelcastComponent-BundleAcreateaninstanceandpublishesitasanOSGIservice]]
+Bundle A create an instance and publishes it as an OSGI service
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ 
+
+[source,xml]
+--------------------------------------------------------------------------------------------------------
+<bean id="config" class="com.hazelcast.config.FileSystemXmlConfig">
+    <argument type="java.lang.String" value="${hazelcast.config}"/>
+</bean>
+
+<bean id="hazelcastInstance" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance">
+    <argument type="com.hazelcast.config.Config" ref="config"/>
+</bean>
+
+<!-- publishing the hazelcastInstance as a service -->
+<service ref="hazelcastInstance" interface="com.hazelcast.core.HazelcastInstance" />
+--------------------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-BundleBusestheinstance]]
+Bundle B uses the instance
+++++++++++++++++++++++++++
+
+[source,xml]
+--------------------------------------------------------------------------------------
+<!-- referencing the hazelcastInstance as a service -->
+<reference ref="hazelcastInstance" interface="com.hazelcast.core.HazelcastInstance" />
+
+<camelContext xmlns="http://camel.apache.org/schema/blueprint">
+    <route id="testHazelcastInstanceBeanRefPut">
+        <from uri="direct:testHazelcastInstanceBeanRefPut"/>
+        <setHeader headerName="CamelHazelcastOperationType">
+            <constant>put</constant>
+        </setHeader>
+        <to uri="hazelcast:map:testmap?hazelcastInstance=#hazelcastInstance"/>
+    </route>
+
+    <route id="testHazelcastInstanceBeanRefGet">
+        <from uri="direct:testHazelcastInstanceBeanRefGet" />
+        <setHeader headerName="CamelHazelcastOperationType">
+            <constant>get</constant>
+        </setHeader>
+        <to uri="hazelcast:map:testmap?hazelcastInstance=#hazelcastInstance"/>
+        <to uri="seda:out" />
+    </route>
+</camelContext>
+--------------------------------------------------------------------------------------
+
+[[HazelcastComponent-UsageofReplicatedmap]]
+Usage of Replicated map
+^^^^^^^^^^^^^^^^^^^^^^^
+
+*Avalaible from Camel 2.16*
+
+[[HazelcastComponent-replicatedmapcacheproducer]]
+replicatedmap cache producer
+++++++++++++++++++++++++++++
+
+A replicated map is a weakly consistent, distributed key-value data
+structure with no data partition. The replicatedmap producer provides 4
+operations (put, get, delete, clear).
+
+Header Variables for the request message:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastOperationType` |`String` | valid values are: put, get, removevalue, delete
+
+|`CamelHazelcastObjectId` |`String` | the object id to store / find your object inside the cache
+|=======================================================================
+
+[[HazelcastComponent-Sampleforput:.3]]
+Sample for *put*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:put")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION))
+.to(String.format("hazelcast:%sbar", HazelcastConstants.REPLICATEDMAP_PREFIX));
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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:replicatedmap:foo" />
+</route>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforget:.4]]
+Sample for *get*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:get")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.REPLICATEDMAP_PREFIX)
+.to("seda:out");
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<route>
+    <from uri="direct:get" />
+    <log message="get.."/>
+        <!-- If using version 2.8 and above set headerName to "CamelHazelcastOperationType" -->
+    <setHeader headerName="hazelcast.operation.type">
+        <constant>get</constant>
+    </setHeader>
+    <to uri="hazelcast:replicatedmap:foo" />
+    <to uri="seda:out" />
+</route>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Samplefordelete:.2]]
+Sample for *delete*:
+
+Java DSL:
+
+[source,java]
+---------------------------------------------------------------------------------------
+from("direct:delete")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DELETE_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.REPLICATEDMAP_PREFIX);
+---------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<route>
+    <from uri="direct: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:replicatedmap:foo" />
+</route>
+-----------------------------------------------------------------------------------------------
+
+you can call them in your test class with:
+
+[source,java]
+------------------------------------------------------------------------------------------------------------
+template.sendBodyAndHeader("direct:[put|get|delete|clear]", "my-foo", HazelcastConstants.OBJECT_ID, "4711");
+------------------------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-replicatedmapcacheconsumer]]
+replicatedmap cache consumer
+++++++++++++++++++++++++++++
+
+For the multimap cache this component provides the same listeners /
+variables as for the map cache consumer (except the update and enviction
+listener). The only difference is the *multimap* prefix inside the URI.
+Here is a sample:
+
+[source,java]
+--------------------------------------------------------------------------------------------------
+fromF("hazelcast:%sbar", HazelcastConstants.MULTIMAP_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.REMOVED))
+                .log("...removed")
+                .to("mock:removed")
+        .otherwise()
+                .log("fail!");
+--------------------------------------------------------------------------------------------------
+
+Header Variables inside the response message:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastListenerTime` |`Long` |time of the event in millis
+
+|`CamelHazelcastListenerType` |`String` |the map consumer sets here "cachelistener"
+
+|`CamelHazelcastListenerAction` |`String` |type of event - here *added* and *removed* (and soon *envicted*)
+
+|`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 replicatedmap
+|=======================================================================
+
+[[HazelcastComponent-UsageofRingbuffer]]
+Usage of Ringbuffer
+^^^^^^^^^^^^^^^^^^^
+
+*Avalaible from Camel 2.16*
+
+[[HazelcastComponent-ringbuffercacheproducer]]
+ringbuffer cache producer 
++++++++++++++++++++++++++
+
+Ringbuffer is a distributed data structure where the data is stored in a
+ring-like structure. You can think of it as a circular array with a
+certain capacity. The ringbuffer producer provides 5 operations (add,
+readonceHead, readonceTail, remainingCapacity, capacity).
+
+Header Variables for the request message:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Type |Description
+
+|`CamelHazelcastOperationType` |`String` |valid values are: put, get, removevalue, delete
+
+|`CamelHazelcastObjectId` |`String` |the object id to store / find your object inside the cache
+|=======================================================================
+
+[[HazelcastComponent-Sampleforput:.4]]
+Sample for *put*:
+
+Java DSL:
+
+[source,java]
+------------------------------------------------------------------------------------
+from("direct:put")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.ADD_OPERATION))
+.to(String.format("hazelcast:%sbar", HazelcastConstants.RINGBUFFER_PREFIX));
+------------------------------------------------------------------------------------
+
+Spring DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+<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>add</constant>
+    </setHeader>
+    <to uri="hazelcast:ringbuffer:foo" />
+</route>
+-----------------------------------------------------------------------------------------------
+
+[[HazelcastComponent-Sampleforreadoncefromhead:]]
+Sample for *readonce from head*:
+
+Java DSL:
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+from("direct:get")
+.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.READ_ONCE_HEAD_OPERATION))
+.toF("hazelcast:%sbar", HazelcastConstants.RINGBUFFER_PREFIX)
+.to("seda:out");
+-----------------------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/2c153ed4/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 489fdab..51bd3f0 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -146,6 +146,7 @@
     * [Guava Eventbus](guava-eventbus.adoc)
     * [Guice](guice.adoc)
     * [Hawtdb](hawtdb.adoc)
+    * [Hazelcast](hazelcast.adoc)
     * [Ironmq](ironmq.adoc)
     * [JMS](jms.adoc)
     * [JMX](jmx.adoc)


[3/4] camel git commit: Added camel-hawtdb docs to gitbook

Posted by ac...@apache.org.
Added camel-hawtdb docs to gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/893081c1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/893081c1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/893081c1

Branch: refs/heads/master
Commit: 893081c188bbe19cf8ce1f669d6bb61c1f2ca939
Parents: ae4ebd3
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sat Apr 2 15:21:31 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sat Apr 2 15:21:31 2016 +0200

----------------------------------------------------------------------
 .../camel-hawtdb/src/main/docs/hawtdb.adoc      | 195 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 196 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/893081c1/components/camel-hawtdb/src/main/docs/hawtdb.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hawtdb/src/main/docs/hawtdb.adoc b/components/camel-hawtdb/src/main/docs/hawtdb.adoc
new file mode 100644
index 0000000..9413cf1
--- /dev/null
+++ b/components/camel-hawtdb/src/main/docs/hawtdb.adoc
@@ -0,0 +1,195 @@
+[[HawtDB-HawtDB]]
+HawtDB
+~~~~~~
+
+*Available as of Camel 2.3*
+
+http://hawtdb.fusesource.org/[HawtDB] is a very lightweight and
+embedable key value database. It allows together with Camel to provide
+persistent support for various Camel features such as
+link:aggregator2.html[Aggregator].
+
+*Deprecated*
+
+The http://hawtdb.fusesource.org/[HawtDB] project is being deprecated
+and replaced by https://code.google.com/p/leveldb/[leveldb] as the
+lightweight and embedable key value database. To make using leveldb easy
+there is a https://github.com/fusesource/leveldbjni[leveldbjni] project
+for that. The Apache ActiveMQ project is planning on using leveldb as
+their primary file based message store in the future, to replace kahadb.
+
+There os a link:leveldb.html[camel-leveldb] component we recommend to
+use instead of this.
+
+*Issue with HawtDB 1.4 or older*
+
+There is a bug in HawtDB 1.4 or older which means the filestore will not
+free unused space. That means the file keeps growing. This has been
+fixed in HawtDB 1.5 which is shipped with Camel 2.5 onwards.
+
+Current features it provides:
+
+* HawtDBAggregationRepository
+
+[[HawtDB-UsingHawtDBAggregationRepository]]
+Using HawtDBAggregationRepository
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+`HawtDBAggregationRepository` is an `AggregationRepository` which on the
+fly persists the aggregated messages. This ensures that you will not
+loose messages, as the default aggregator will use an in memory only
+`AggregationRepository`.
+
+It has the following options:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Option |Type |Description
+
+|`repositoryName` |String |A mandatory repository name. Allows you to use a shared `HawtDBFile` for
+multiple repositories.
+
+|`persistentFileName` |String |Filename for the persistent storage. If no file exists on startup a new
+file is created.
+
+|`bufferSize` |int |The size of the memory segment buffer which is mapped to the file store.
+By default its 8mb. The value is in bytes.
+
+|`sync` |boolean |Whether or not the `HawtDBFile` should sync on write or not. Default is
+`true`. By sync on write ensures that its always waiting for all writes
+to be spooled to disk and thus will not loose updates. If you disable
+this option, then HawtDB will auto sync when it has batched up a number
+of writes.
+
+|`pageSize` |short |The size of memory pages. By default its 512 bytes. The value is in
+bytes.
+
+|`hawtDBFile` |HawtDBFile |Use an existing configured
+`org.apache.camel.component.hawtdb.HawtDBFile` instance.
+
+|`returnOldExchange` |boolean |Whether the get operation should return the old existing Exchange if any
+existed. By default this option is `false` to optimize as we do not need
+the old exchange when aggregating.
+
+|`useRecovery` |boolean |Whether or not recovery is enabled. This option is by default `true`.
+When enabled the Camel link:aggregator2.html[Aggregator] automatic
+recover failed aggregated exchange and have them resubmitted.
+
+|`recoveryInterval` |long |If recovery is enabled then a background task is run every x'th time to
+scan for failed exchanges to recover and resubmit. By default this
+interval is 5000 millis.
+
+|`maximumRedeliveries` |int |Allows you to limit the maximum number of redelivery attempts for a
+recovered exchange. If enabled then the Exchange will be moved to the
+dead letter channel if all redelivery attempts failed. By default this
+option is disabled. If this option is used then the `deadLetterUri`
+option must also be provided.
+
+|`deadLetterUri` |String |An endpoint uri for a link:dead-letter-channel.html[Dead Letter Channel]
+where exhausted recovered Exchanges will be moved. If this option is
+used then the `maximumRedeliveries` option must also be provided.
+
+|`optimisticLocking` |`false` |*Camel 2.12:* To turn on optimistic locking, which often would be needed
+in clustered environments where multiple Camel applications shared the
+same HawtDB based aggregation repository.
+|=======================================================================
+
+The `repositoryName` option must be provided. Then either the
+`persistentFileName` or the `hawtDBFile` must be provided.
+
+[[HawtDB-Whatispreservedwhenpersisting]]
+What is preserved when persisting
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+`HawtDBAggregationRepository` will only preserve any `Serializable`
+compatible data types. If a data type is not such a type its dropped and
+a `WARN` is logged. And it only persists the `Message` body and the
+`Message` headers. The `Exchange` properties are *not* persisted.
+
+[[HawtDB-Recovery]]
+Recovery
+^^^^^^^^
+
+The `HawtDBAggregationRepository` will by default recover any failed
+link:exchange.html[Exchange]. It does this by having a background tasks
+that scans for failed link:exchange.html[Exchange]s in the persistent
+store. You can use the `checkInterval` option to set how often this task
+runs. The recovery works as transactional which ensures that Camel will
+try to recover and redeliver the failed link:exchange.html[Exchange].
+Any link:exchange.html[Exchange] which was found to be recovered will be
+restored from the persistent store and resubmitted and send out again.
+
+The following headers is set when an link:exchange.html[Exchange] is
+being recovered/redelivered:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Header |Type |Description
+
+|`Exchange.REDELIVERED` |Boolean |Is set to true to indicate the link:exchange.html[Exchange] is being
+redelivered.
+
+|`Exchange.REDELIVERY_COUNTER` |Integer |The redelivery attempt, starting from 1.
+|=======================================================================
+
+Only when an link:exchange.html[Exchange] has been successfully
+processed it will be marked as complete which happens when the `confirm`
+method is invoked on the `AggregationRepository`. This means if the same
+link:exchange.html[Exchange] fails again it will be kept retried until
+it success.
+
+You can use option `maximumRedeliveries` to limit the maximum number of
+redelivery attempts for a given recovered link:exchange.html[Exchange].
+You must also set the `deadLetterUri` option so Camel knows where to
+send the link:exchange.html[Exchange] when the `maximumRedeliveries` was
+hit.
+
+You can see some examples in the unit tests of camel-hawtdb, for example
+https://svn.apache.org/repos/asf/camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateRecoverTest.java[this
+test].
+
+[[HawtDB-UsingHawtDBAggregationRepositoryinJavaDSL]]
+Using HawtDBAggregationRepository in Java DSL
++++++++++++++++++++++++++++++++++++++++++++++
+
+In this example we want to persist aggregated messages in the
+`target/data/hawtdb.dat` file.
+
+[[HawtDB-UsingHawtDBAggregationRepositoryinSpringXML]]
+Using HawtDBAggregationRepository in Spring XML
++++++++++++++++++++++++++++++++++++++++++++++++
+
+The same example but using Spring XML instead:
+
+[[HawtDB-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use link:hawtdb.html[HawtDB] in your camel routes you need to add the
+a dependency on *camel-hawtdb*.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,xml]
+---------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-hawtdb</artifactId>
+  <version>2.3.0</version>
+</dependency>
+---------------------------------------
+
+[[HawtDB-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+
+* link:aggregator2.html[Aggregator]
+* link:components.html[Components]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/893081c1/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 8c260ef..489fdab 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -145,6 +145,7 @@
         * [Groovy DSL](groovy-dsl.adoc)
     * [Guava Eventbus](guava-eventbus.adoc)
     * [Guice](guice.adoc)
+    * [Hawtdb](hawtdb.adoc)
     * [Ironmq](ironmq.adoc)
     * [JMS](jms.adoc)
     * [JMX](jmx.adoc)