http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc new file mode 100644 index 0000000..ab01655 --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc @@ -0,0 +1,336 @@ +## Hazelcast Map Component + +*Available as of Camel version 2.7* + +The http://www.hazelcast.com/[Hazelcast] Map component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast distributed map. + + +### Options + +// component options: START +The Hazelcast Map component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END +// endpoint options: START +The Hazelcast Map endpoint is configured using URI syntax: + + hazelcast-map:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + + +### 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 follow operations specified by *CamelHazelcastOperationType* header: + +* put +* putIfAbsent +* get +* getAll +* keySet +* containsKey +* containsValue +* delete +* update +* query +* clear +* evict +* evictAll + +All operations are provide the 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` | as already described. + +|`CamelHazelcastObjectId` |`String` |the object id to store / find your object inside the cache (not needed for the query operation) +|======================================================================= + +*put* and *putIfAbsent* operations provide an eviction mechanism: + +[width="100%",cols="10%,10%,80%",options="header",] +|======================================================================= +|Name |Type |Description +|`CamelHazelcastObjectTtlValue` |`Integer` | value of TTL. + +|`CamelHazelcastObjectTtlUnit` |`java.util.concurrent.TimeUnit` | value of time unit ( DAYS / HOURS / MINUTES / .... +|======================================================================= + +You can call the samples with: + +[source,java] +------------------------------------------------------------------------------------------------------------------- +template.sendBodyAndHeader("direct:[put|get|update|delete|query|evict]", "my-foo", HazelcastConstants.OBJECT_ID, "4711"); +------------------------------------------------------------------------------------------------------------------- + +#### 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> +----------------------------------------------------------------------------------------------- + +Sample for *put* with eviction: + +Java DSL: + +[source,java] +------------------------------------------------------------------------------------ +from("direct:put") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION)) +.setHeader(HazelcastConstants.TTL_VALUE, constant(Long.valueOf(1))) +.setHeader(HazelcastConstants.TTL_UNIT, constant(TimeUnit.MINUTES)) +.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> + <setHeader headerName="HazelcastConstants.TTL_VALUE"> + <simple resultType="java.lang.Long">1</simple> + </setHeader> + <setHeader headerName="HazelcastConstants.TTL_UNIT"> + <simple resultType="java.util.concurrent.TimeUnit">TimeUnit.MINUTES</simple> + </setHeader> + <to uri="hazelcast-map:foo" /> +</route> +----------------------------------------------------------------------------------------------- + + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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); +------------------------------------------------------------------------------- + + +### 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!"); +--------------------------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-multimap-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-multimap-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-multimap-component.adoc new file mode 100644 index 0000000..f19f4a4 --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-multimap-component.adoc @@ -0,0 +1,237 @@ +## Hazelcast Multimap Component + +*Available as of Camel version 2.7* + +The http://www.hazelcast.com/[Hazelcast] Multimap component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast distributed multimap. + + +### Options + +// component options: START +The Hazelcast Multimap component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END + +// endpoint options: START +The Hazelcast Multimap endpoint is configured using URI syntax: + + hazelcast-multimap:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + + +### 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 +|======================================================================= + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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. + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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"); +------------------------------------------------------------------------------------------------------------------ + +### 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 +|======================================================================= http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-queue-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-queue-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-queue-component.adoc new file mode 100644 index 0000000..1b2b5f7 --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-queue-component.adoc @@ -0,0 +1,142 @@ +## Hazelcast Queue Component + +*Available as of Camel version 2.7* + +The http://www.hazelcast.com/[Hazelcast] Queue component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast distributed queue. + + +### Options + +// component options: START +The Hazelcast Queue component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END +// endpoint options: START +The Hazelcast Queue endpoint is configured using URI syntax: + + hazelcast-queue:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + +### Queue producer â to(âhazelcast-queue:fooâ) + +The queue producer provides 6 operations: +* add +* put +* poll +* peek +* offer +* removevalue + +#### Sample for *add*: + +[source,java] +------------------------------------------------------------------------------------ +from("direct:add") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.ADD_OPERATION)) +.toF("hazelcast-%sbar", HazelcastConstants.QUEUE_PREFIX); +------------------------------------------------------------------------------------ + +#### Sample for *put*: + +[source,java] +------------------------------------------------------------------------------------ +from("direct:put") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUT_OPERATION)) +.toF("hazelcast-%sbar", HazelcastConstants.QUEUE_PREFIX); +------------------------------------------------------------------------------------ + +#### Sample for *poll*: + +[source,java] +------------------------------------------------------------------------------------- +from("direct:poll") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.POLL_OPERATION)) +.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX); +------------------------------------------------------------------------------------- + +#### Sample for *peek*: + +[source,java] +------------------------------------------------------------------------------------- +from("direct:peek") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PEEK_OPERATION)) +.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX); +------------------------------------------------------------------------------------- + +#### Sample for *offer*: + +[source,java] +-------------------------------------------------------------------------------------- +from("direct:offer") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.OFFER_OPERATION)) +.toF("hazelcast:%sbar", HazelcastConstants.QUEUE_PREFIX); +-------------------------------------------------------------------------------------- + +#### Sample for *removevalue*: + +[source,java] +-------------------------------------------------------------------------------------------- +from("direct:removevalue") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.REMOVEVALUE_OPERATION)) +.toF("hazelcast-%sbar", HazelcastConstants.QUEUE_PREFIX); +-------------------------------------------------------------------------------------------- + +### 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!"); +------------------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc new file mode 100644 index 0000000..8a87c28 --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc @@ -0,0 +1,210 @@ +## Hazelcast Replicated Map Component + +*Available as of Camel version 2.16* + +The http://www.hazelcast.com/[Hazelcast] instance component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to consume join/leave events of the cache instance in the cluster. +A replicated map is a weakly consistent, distributed key-value data structure with no data partition. + + +### Options + +// component options: START +The Hazelcast Replicated Map component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END +// endpoint options: START +The Hazelcast Replicated Map endpoint is configured using URI syntax: + + hazelcast-replicatedmap:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + + +### replicatedmap cache producer + +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 +|======================================================================= + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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"); +------------------------------------------------------------------------------------------------------------ + +### 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 +|======================================================================= + http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-ringbuffer-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-ringbuffer-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-ringbuffer-component.adoc new file mode 100644 index 0000000..1a9001a --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-ringbuffer-component.adoc @@ -0,0 +1,116 @@ +## Hazelcast Ringbuffer Component + +*Available as of Camel version 2.16* + +*Avalaible from Camel 2.16* + +The http://www.hazelcast.com/[Hazelcast] ringbuffer component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast ringbuffer. +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. + +### Options + +// component options: START +The Hazelcast Ringbuffer component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END + +// endpoint options: START +The Hazelcast Ringbuffer endpoint is configured using URI syntax: + + hazelcast-ringbuffer:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (9 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **defaultOperation** (producer) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (producer) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (producer) | 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. | | String +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + + +### ringbuffer cache producer + +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 +|======================================================================= + +#### 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> +----------------------------------------------------------------------------------------------- + +#### 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/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-seda-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-seda-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-seda-component.adoc new file mode 100644 index 0000000..165dc0a4 --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-seda-component.adoc @@ -0,0 +1,104 @@ +## Hazelcast SEDA Component + +*Available as of Camel version 2.7* + +The http://www.hazelcast.com/[Hazelcast] SEDA component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast BlockingQueue. +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. + + +### Options + +// component options: START +The Hazelcast SEDA component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END +// endpoint options: START +The Hazelcast SEDA endpoint is configured using URI syntax: + + hazelcast-seda:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + +### SEDA producer â to(âhazelcast-seda:fooâ) + +The SEDA producer provides no operations. You only send data to the +specified queue. + +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> +---------------------------------- + +### SEDA consumer â from(âhazelcast-seda:fooâ) + +The SEDA consumer provides no operations. You only retrieve data from +the specified queue. + +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> +----------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-set-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-set-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-set-component.adoc new file mode 100644 index 0000000..529faa5 --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-set-component.adoc @@ -0,0 +1,56 @@ +## Hazelcast Set Component + +*Available as of Camel version 2.7* + +The http://www.hazelcast.com/[Hazelcast] Set component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast distributed set. + + +### Options + +// component options: START +The Hazelcast Set component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END +// endpoint options: START +The Hazelcast Set endpoint is configured using URI syntax: + + hazelcast-set:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/docs/hazelcast-topic-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-topic-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-topic-component.adoc new file mode 100644 index 0000000..b6e224b --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast-topic-component.adoc @@ -0,0 +1,88 @@ +## Hazelcast Topic Component + +*Available as of Camel version 2.15* + +The http://www.hazelcast.com/[Hazelcast] Topic component is one of link:hazelcast.html[Camel Hazelcast Components] which allows you to access Hazelcast distributed topic. + + +### Options + +// component options: START +The Hazelcast Topic component supports 3 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **hazelcastInstance** (advanced) | 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. | | HazelcastInstance +| **hazelcastMode** (advanced) | The hazelcast mode reference which kind of instance should be used. If you don't specify the mode then the node mode will be the default. | node | String +| **resolveProperty Placeholders** (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|======================================================================= +// component options: END +// endpoint options: START +The Hazelcast Topic endpoint is configured using URI syntax: + + hazelcast-topic:cacheName + +with the following path and query parameters: + +#### Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **cacheName** | *Required* The name of the cache | | String +|======================================================================= + +#### Query Parameters (12 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|======================================================================= +| Name | Description | Default | Type +| **defaultOperation** (common) | To specify a default operation to use if no operation header has been provided. | | String +| **hazelcastInstance** (common) | The hazelcast instance reference which can be used for hazelcast endpoint. | | HazelcastInstance +| **hazelcastInstanceName** (common) | 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. | | String +| **reliable** (common) | Define if the endpoint will use a reliable Topic struct or not. | false | boolean +| **bridgeErrorHandler** (consumer) | 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 or ERROR level and ignored. | false | boolean +| **exceptionHandler** (consumer) | 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 or ERROR level and ignored. | | ExceptionHandler +| **exchangePattern** (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern +| **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +| **concurrentConsumers** (seda) | To use concurrent consumers polling from the SEDA queue. | 1 | int +| **pollTimeout** (seda) | 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. | 1000 | int +| **transacted** (seda) | 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. | false | boolean +| **transferExchange** (seda) | If set to true the whole Exchange will be transfered. If header or body contains not serializable objects they will be skipped. | false | boolean +|======================================================================= +// endpoint options: END + + + +### Topic producer â to(âhazelcast-topic:fooâ) + +The topic producer provides only one operation (publish). + +#### Sample for *publish*: + +[source,java] +---------------------------------------------------------------------------------------- +from("direct:add") +.setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.PUBLISH_OPERATION)) +.toF("hazelcast-%sbar", HazelcastConstants.PUBLISH_OPERATION); +---------------------------------------------------------------------------------------- + +### 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") +-------------------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/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..55f638d --- /dev/null +++ b/components/camel-hazelcast/src/main/docs/hazelcast.adoc @@ -0,0 +1,165 @@ +## Hazelcast Component + +*Available as of Camel version 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> +------------------------------------------------------------ + + +### Hazelcast components +See followings for each component usage: +* link:hazelcast-map-component.html[map] +* link:hazelcast-multimap-component.html[multimap] +* link:hazelcast-queue-component.html[queue] +* link:hazelcast-topic-component.html[topic] +* link:hazelcast-list-component.html[list] +* link:hazelcast-seda-component.html[seda] +* link:hazelcast-set-component.html[set] +* link:hazelcast-atomicvalue-component.html[atomic number] +* link:hazelcast-instance-component.html[cluster support (instance)] +* link:hazelcast-replicatedmap-component.html[replicatedmap] +* link:hazelcast-ringbuffer-component.html[ringbuffer] + + + +### Using hazelcast reference + +#### 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> +-------------------------------------------------------------------------------------------------------- + +#### 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> +------------------------------------------------------------------------------ + +### 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. + +#### 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" /> +-------------------------------------------------------------------------------------------------------- + +#### 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> +-------------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastComponent.java index b4b0414..55f8d0e 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastComponent.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastComponent.java @@ -56,43 +56,30 @@ import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_ import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_INSTANCE_NAME_PARAM; import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_INSTANCE_PARAM; -public class HazelcastComponent extends DefaultComponent { - private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastComponent.class); +/** + * @deprecated + * + */ +@Deprecated +public class HazelcastComponent extends HazelcastDefaultComponent { - private final Set<HazelcastInstance> customHazelcastInstances; - @Metadata(label = "advanced") - private HazelcastInstance hazelcastInstance; - @Metadata(label = "advanced", defaultValue = "" + HazelcastConstants.HAZELCAST_NODE_MODE) - private String hazelcastMode = HazelcastConstants.HAZELCAST_NODE_MODE; + private static final Logger LOG = LoggerFactory.getLogger(HazelcastComponent.class); public HazelcastComponent() { super(); - this.customHazelcastInstances = new LinkedHashSet<>(); } public HazelcastComponent(final CamelContext context) { super(context); - this.customHazelcastInstances = new LinkedHashSet<>(); } @Override - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - - // use the given hazelcast Instance or create one if not given - HazelcastInstance hzInstance; - if (ObjectHelper.equal(hazelcastMode, HazelcastConstants.HAZELCAST_NODE_MODE)) { - hzInstance = getOrCreateHzInstance(getCamelContext(), parameters); - } else { - hzInstance = getOrCreateHzClientInstance(getCamelContext(), parameters); - } - - String defaultOperation = getAndRemoveOrResolveReferenceParameter(parameters, HazelcastConstants.OPERATION_PARAM, String.class); - if (defaultOperation == null) { - defaultOperation = getAndRemoveOrResolveReferenceParameter(parameters, "defaultOperation", String.class); - } + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { HazelcastDefaultEndpoint endpoint = null; + LOG.warn("The scheme syntax 'hazelcast:{}' has been deprecated. Use 'hazelcast-{}' instead.", remaining, remaining); + // check type of endpoint if (remaining.startsWith(HazelcastConstants.MAP_PREFIX)) { // remaining is the cache name @@ -184,149 +171,7 @@ public class HazelcastComponent extends DefaultComponent { HazelcastConstants.MAP_PREFIX, HazelcastConstants.MULTIMAP_PREFIX, HazelcastConstants.ATOMICNUMBER_PREFIX, HazelcastConstants.INSTANCE_PREFIX, HazelcastConstants.QUEUE_PREFIX, HazelcastConstants.SEDA_PREFIX, HazelcastConstants.LIST_PREFIX, HazelcastConstants.REPLICATEDMAP_PREFIX, HazelcastConstants.SET_PREFIX, HazelcastConstants.RINGBUFFER_PREFIX, uri)); } - - endpoint.setDefaultOperation(defaultOperation); - return endpoint; } - @Override - public void doStart() throws Exception { - super.doStart(); - } - - @Override - public void doStop() throws Exception { - for (HazelcastInstance hazelcastInstance : customHazelcastInstances) { - hazelcastInstance.getLifecycleService().shutdown(); - } - - customHazelcastInstances.clear(); - - super.doStop(); - } - - public HazelcastInstance getHazelcastInstance() { - return 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. - */ - public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { - this.hazelcastInstance = hazelcastInstance; - } - - public String getHazelcastMode() { - return hazelcastMode; - } - - /** - * The hazelcast mode reference which kind of instance should be used. - * If you don't specify the mode, then the node mode will be the default. - */ - public void setHazelcastMode(String hazelcastMode) { - this.hazelcastMode = hazelcastMode; - } - - private HazelcastInstance getOrCreateHzInstance(CamelContext context, Map<String, Object> parameters) throws Exception { - HazelcastInstance hzInstance = null; - Config config = null; - - // Query param named 'hazelcastInstance' (if exists) overrides the instance that was set - hzInstance = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_INSTANCE_PARAM, HazelcastInstance.class); - - // Check if an already created instance is given then just get instance by its name. - if (hzInstance == null && parameters.get(HAZELCAST_INSTANCE_NAME_PARAM) != null) { - hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM)); - } - - // If instance neither supplied nor found by name, try to lookup its config - // as reference or as xml configuration file. - if (hzInstance == null) { - config = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_CONFIGU_PARAM, Config.class); - if (config == null) { - String configUri = getAndRemoveParameter(parameters, HAZELCAST_CONFIGU_URI_PARAM, String.class); - if (configUri != null) { - configUri = getCamelContext().resolvePropertyPlaceholders(configUri); - } - if (configUri != null) { - InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, configUri); - config = new XmlConfigBuilder(is).build(); - } - } - - if (hazelcastInstance == null && config == null) { - config = new XmlConfigBuilder().build(); - // Disable the version check - config.getProperties().setProperty("hazelcast.version.check.enabled", "false"); - config.getProperties().setProperty("hazelcast.phone.home.enabled", "false"); - - hzInstance = Hazelcast.newHazelcastInstance(config); - } else if (config != null) { - if (ObjectHelper.isNotEmpty(config.getInstanceName())) { - hzInstance = Hazelcast.getOrCreateHazelcastInstance(config); - } else { - hzInstance = Hazelcast.newHazelcastInstance(config); - } - } - - if (hzInstance != null) { - if (this.customHazelcastInstances.add(hzInstance)) { - LOGGER.debug("Add managed HZ instance {}", hzInstance.getName()); - } - } - } - - return hzInstance == null ? hazelcastInstance : hzInstance; - } - - private HazelcastInstance getOrCreateHzClientInstance(CamelContext context, Map<String, Object> parameters) throws Exception { - HazelcastInstance hzInstance = null; - ClientConfig config = null; - - // Query param named 'hazelcastInstance' (if exists) overrides the instance that was set - hzInstance = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_INSTANCE_PARAM, HazelcastInstance.class); - - // Check if an already created instance is given then just get instance by its name. - if (hzInstance == null && parameters.get(HAZELCAST_INSTANCE_NAME_PARAM) != null) { - hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM)); - } - - // If instance neither supplied nor found by name, try to lookup its config - // as reference or as xml configuration file. - if (hzInstance == null) { - config = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_CONFIGU_PARAM, ClientConfig.class); - if (config == null) { - String configUri = getAndRemoveParameter(parameters, HAZELCAST_CONFIGU_URI_PARAM, String.class); - if (configUri != null) { - configUri = getCamelContext().resolvePropertyPlaceholders(configUri); - } - if (configUri != null) { - InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, configUri); - config = new XmlClientConfigBuilder(is).build(); - } - } - - if (hazelcastInstance == null && config == null) { - config = new XmlClientConfigBuilder().build(); - // Disable the version check - config.getProperties().setProperty("hazelcast.version.check.enabled", "false"); - config.getProperties().setProperty("hazelcast.phone.home.enabled", "false"); - - hzInstance = HazelcastClient.newHazelcastClient(config); - } else if (config != null) { - hzInstance = HazelcastClient.newHazelcastClient(config); - } - - if (hzInstance != null) { - if (this.customHazelcastInstances.add(hzInstance)) { - LOGGER.debug("Add managed HZ instance {}", hzInstance.getName()); - } - } - } - - return hzInstance == null ? hazelcastInstance : hzInstance; - } }