camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmvo...@apache.org
Subject [camel] branch master updated: CAMEL-12537: Add docs how to configure additional parameters in camel-infinispan
Date Tue, 19 Jun 2018 10:40:55 GMT
This is an automated email from the ASF dual-hosted git repository.

dmvolod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new defc164  CAMEL-12537: Add docs how to configure additional parameters in camel-infinispan
defc164 is described below

commit defc16461096154e344e4a2bb8b11a79fd304090
Author: Dmitry Volodin <dmvolod@gmail.com>
AuthorDate: Tue Jun 19 13:39:28 2018 +0300

    CAMEL-12537: Add docs how to configure additional parameters in
    camel-infinispan
---
 .../src/main/docs/infinispan-component.adoc          | 20 +++++++++++++++++++-
 .../infinispan/InfinispanConfiguration.java          |  6 +++++-
 .../component/infinispan/InfinispanManager.java      |  4 ++--
 .../springboot/InfinispanComponentConfiguration.java |  7 ++++++-
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/components/camel-infinispan/src/main/docs/infinispan-component.adoc b/components/camel-infinispan/src/main/docs/infinispan-component.adoc
index 25bf9ee..2dce5bc 100644
--- a/components/camel-infinispan/src/main/docs/infinispan-component.adoc
+++ b/components/camel-infinispan/src/main/docs/infinispan-component.adoc
@@ -92,7 +92,7 @@ with the following path and query parameters:
 | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange.
|  | ExchangePattern
 | *operation* (producer) | The operation to perform. | PUT | InfinispanOperation
 | *cacheContainer* (advanced) | Specifies the cache Container to connect |  | BasicCacheContainer
-| *cacheContainerConfiguration* (advanced) | The CacheContainer configuration |  | Object
+| *cacheContainerConfiguration* (advanced) | The CacheContainer configuration. Uses if the
cacheContainer is not defined. Must be the following types: org.infinispan.client.hotrod.configuration.Configuration
- for remote cache interaction configuration; org.infinispan.configuration.cache.Configuration
- for embedded cache interaction configuration; |  | Object
 | *configurationProperties* (advanced) | Implementation specific properties for the CacheManager
|  | Map
 | *configurationUri* (advanced) | An implementation specific URI for the CacheManager | 
| String
 | *flags* (advanced) | A comma separated list of Flag to be applied by default on each cache
invocation, not applicable to remote caches. |  | String
@@ -158,6 +158,24 @@ from("direct:start")
     .to("infinispan:myCacheName");
 ----
 
+* Retrieve a specific key from the remote cache using a cache container configuration with
additional parameters (host, port and protocol version):
++
+[source,java]
+----
+org.infinispan.client.hotrod.configuration.Configuration cacheContainerConfiguration = new
org.infinispan.client.hotrod.configuration.ConfigurationBuilder()
+    .addServer()
+        .host("localhost")
+        .port(9999)
+        .version(org.infinispan.client.hotrod.ProtocolVersion.PROTOCOL_VERSION_25)
+    .build();
+...
+
+from("direct:start")
+    .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.GET)
+    .setHeader(InfinispanConstants.KEY).constant("123")
+    .to("infinispan?cacheContainerConfiguration=#cacheContainerConfiguration");
+----
+
 ### Using the Infinispan based idempotent repository
 
 In this section we will use the Infinispan based idempotent repository.
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java
b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java
index 99cba2e..6c3154d 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java
@@ -256,7 +256,11 @@ public class InfinispanConfiguration implements Cloneable {
     }
 
     /**
-     * The CacheContainer configuration
+     * The CacheContainer configuration. Uses if the cacheContainer is not defined.
+     * Must be the following types:
+     * org.infinispan.client.hotrod.configuration.Configuration - for remote cache interaction
configuration;
+     * org.infinispan.configuration.cache.Configuration - for embedded cache interaction
configuration;
+     * 
      */
     public void setCacheContainerConfiguration(Object cacheContainerConfiguration) {
         this.cacheContainerConfiguration = cacheContainerConfiguration;
diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
index 4ed5d1e..01bbf80 100644
--- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
+++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanManager.java
@@ -61,10 +61,10 @@ public class InfinispanManager implements Service {
         cacheContainer = configuration.getCacheContainer();
 
         if (cacheContainer == null) {
+            final Object containerConf = configuration.getCacheContainerConfiguration();
             // Check if a container configuration object has been provided so use
             // it and discard any other additional configuration.
-            if (configuration.getCacheContainerConfiguration() != null) {
-                final Object containerConf = configuration.getCacheContainerConfiguration();
+            if (containerConf != null) {
                 if (containerConf instanceof org.infinispan.client.hotrod.configuration.Configuration)
{
                     cacheContainer = new RemoteCacheManager(
                         (org.infinispan.client.hotrod.configuration.Configuration)containerConf,
diff --git a/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentConfiguration.java
b/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentConfiguration.java
index bf17c7a..b53c3a0 100644
--- a/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentConfiguration.java
@@ -125,7 +125,12 @@ public class InfinispanComponentConfiguration
          */
         private Map configurationProperties;
         /**
-         * The CacheContainer configuration
+         * The CacheContainer configuration. Uses if the cacheContainer is not
+         * defined. Must be the following types:
+         * org.infinispan.client.hotrod.configuration.Configuration - for remote
+         * cache interaction configuration;
+         * org.infinispan.configuration.cache.Configuration - for embedded cache
+         * interaction configuration;
          */
         private Object cacheContainerConfiguration;
         /**


Mime
View raw message