You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/12/11 07:48:45 UTC

[camel] branch master updated: CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - Docker component

This is an automated email from the ASF dual-hosted git repository.

davsclaus 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 0a4514d  CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - Docker component
0a4514d is described below

commit 0a4514dfa2279777e0e5e3ef8e7fc9fcd8ab0350
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 11 08:48:31 2019 +0100

    CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - Docker component
---
 .../apache/camel/component/docker/DockerComponent.java   |  3 ++-
 .../apache/camel/component/docker/DockerEndpoint.java    | 16 ++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerComponent.java b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerComponent.java
index bd42de3..1fae5cc 100644
--- a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerComponent.java
+++ b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerComponent.java
@@ -61,7 +61,8 @@ public class DockerComponent extends DefaultComponent {
         configuration.setOperation(operation);
 
         Endpoint endpoint = new DockerEndpoint(uri, this, configuration);
-        setProperties(configuration, parameters);
+        setProperties(endpoint, parameters);
+        // and store any left-over parameters on configuration
         configuration.setParameters(parameters);
 
         return endpoint;
diff --git a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerEndpoint.java b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerEndpoint.java
index ef625bd..8bb42c5 100644
--- a/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerEndpoint.java
+++ b/components/camel-docker/src/main/java/org/apache/camel/component/docker/DockerEndpoint.java
@@ -65,14 +65,16 @@ public class DockerEndpoint extends DefaultEndpoint {
     public Consumer createConsumer(Processor processor) throws Exception {
         DockerOperation operation = configuration.getOperation();
 
-        switch (operation) {
-        case EVENTS:
-            return new DockerEventsConsumer(this, processor);
-        case STATS:
-            return new DockerStatsConsumer(this, processor);
-        default:
+        Consumer consumer;
+        if (operation == DockerOperation.EVENTS) {
+            consumer = new DockerEventsConsumer(this, processor);
+        } else if (operation == DockerOperation.STATS) {
+            consumer = new DockerStatsConsumer(this, processor);
+        } else {
             throw new DockerException(operation + " is not a valid consumer operation");
         }
+        configureConsumer(consumer);
+        return consumer;
     }
 
     public DockerConfiguration getConfiguration() {
@@ -84,6 +86,4 @@ public class DockerEndpoint extends DefaultEndpoint {
         return true;
     }
 
-
-
 }