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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 8fe8fa1  CAMEL-17500: Updated Dynamic Router EIP component spring boot 
example. (#46)
8fe8fa1 is described below

commit 8fe8fa1f68ca66d14a0b9b2471180321a2f0528a
Author: Steve Storck <[email protected]>
AuthorDate: Thu Jan 27 14:20:38 2022 -0500

    CAMEL-17500: Updated Dynamic Router EIP component spring boot example. (#46)
    
    * CAMEL-17500: Updated Dynamic Router EIP component spring boot example.
    
    * CAMEL-17500: Updated the example related to the new recipient mode 
parameter.
---
 dynamic-router-eip/README.adoc                              |  4 ++++
 .../numbers/config/DynamicRouterComponentConfig.java        |  3 ++-
 .../example/springboot/numbers/config/ExampleConfig.java    | 13 +++++++++++++
 dynamic-router-eip/src/main/resources/application.yml       |  1 +
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/dynamic-router-eip/README.adoc b/dynamic-router-eip/README.adoc
index 5da7f04..b1c0a7e 100644
--- a/dynamic-router-eip/README.adoc
+++ b/dynamic-router-eip/README.adoc
@@ -104,6 +104,10 @@ You can run this example using:
 
     $ mvn spring-boot:run
 
+If you want to run the Dynamic Router in "allMatch" receiver mode, run the 
example with an argument specifying that configuration property:
+
+    $ mvn spring-boot:run 
-Dspring-boot.run.arguments="--camel.spring-boot.example.dynamic-router-eip.recipient-mode=allMatch"
+
 The results should show up in less than ten seconds, and the program will 
immediately terminate.
 
 === Help and contributions
diff --git 
a/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/DynamicRouterComponentConfig.java
 
b/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/DynamicRouterComponentConfig.java
index 2747991..237f61c 100644
--- 
a/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/DynamicRouterComponentConfig.java
+++ 
b/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/DynamicRouterComponentConfig.java
@@ -72,7 +72,8 @@ public class DynamicRouterComponentConfig {
         return new RouteBuilder() {
             @Override
             public void configure() {
-                from(exampleConfig.getStartUri()).to(COMPONENT_SCHEME + ":" + 
exampleConfig.getRoutingChannel());
+                from(exampleConfig.getStartUri())
+                        .to(COMPONENT_SCHEME + ":" + 
exampleConfig.getRoutingChannel() + "?recipientMode=" + 
exampleConfig.getRecipientMode());
             }
         };
     }
diff --git 
a/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/ExampleConfig.java
 
b/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/ExampleConfig.java
index b6dfaa7..c96b049 100644
--- 
a/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/ExampleConfig.java
+++ 
b/dynamic-router-eip/src/main/java/org/apache/camel/example/springboot/numbers/config/ExampleConfig.java
@@ -45,6 +45,11 @@ public class ExampleConfig {
      */
     private String startUri;
 
+    /**
+     * The recipient mode -- first matching filter only, or all matching 
filters.
+     */
+    private String recipientMode;
+
     public String getStartUri() {
         return startUri;
     }
@@ -76,4 +81,12 @@ public class ExampleConfig {
     public void setReceiverScheme(String receiverScheme) {
         this.receiverScheme = receiverScheme;
     }
+
+    public String getRecipientMode() {
+        return this.recipientMode;
+    }
+
+    public void setRecipientMode(String recipientMode) {
+        this.recipientMode = recipientMode;
+    }
 }
diff --git a/dynamic-router-eip/src/main/resources/application.yml 
b/dynamic-router-eip/src/main/resources/application.yml
index a0d6518..1db08e0 100644
--- a/dynamic-router-eip/src/main/resources/application.yml
+++ b/dynamic-router-eip/src/main/resources/application.yml
@@ -26,6 +26,7 @@ camel:
         subscribe-uri: dynamic-router:control
         receiver-scheme: direct
         start-uri: direct:start
+        recipient-mode: firstMatch
   component:
     dynamic-router:
       lazy-start-producer: true

Reply via email to