camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: fix documentation (map section)
Date Sun, 11 Sep 2016 06:43:44 GMT
fix documentation (map section)


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

Branch: refs/heads/master
Commit: b3deccc37a2f2d7c729137187f73e5b062434cb0
Parents: 4bcef80
Author: Fabryprog <fabryprog@gmail.com>
Authored: Sat Sep 10 16:03:51 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Sep 11 08:43:28 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/hazelcast-component.adoc      | 70 ++++++++++++++++++--
 1 file changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b3deccc3/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
index 8d402b0..8d82fd7 100644
--- a/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
+++ b/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
@@ -120,9 +120,25 @@ 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
+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:
@@ -130,16 +146,26 @@ 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, keySet. 
+|`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]", "my-foo", HazelcastConstants.OBJECT_ID,
"4711");
+template.sendBodyAndHeader("direct:[put|get|update|delete|query|evict]", "my-foo", HazelcastConstants.OBJECT_ID,
"4711");
 -------------------------------------------------------------------------------------------------------------------
 
 [[HazelcastComponent-Sampleforput:]]
@@ -168,6 +194,40 @@ Spring DSL:
 </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>
+-----------------------------------------------------------------------------------------------
+
+
 [[HazelcastComponent-Sampleforget:]]
 Sample for *get*:
 


Mime
View raw message