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-spring-boot-examples.git
The following commit(s) were added to refs/heads/master by this push: new 00309b0 rabbitmq example should use the new spring-rabbitmq component 00309b0 is described below commit 00309b07e05bbb30393fdc96d33bb2b003d3799c Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jan 12 12:26:58 2021 +0100 rabbitmq example should use the new spring-rabbitmq component --- camel-example-spring-boot-rabbitmq/pom.xml | 19 ++++++------------- .../src/main/java/sample/camel/SampleCamelRouter.java | 4 ++-- .../src/main/resources/application.properties | 15 +++++++++------ 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/camel-example-spring-boot-rabbitmq/pom.xml b/camel-example-spring-boot-rabbitmq/pom.xml index 2462c65..702c09c 100644 --- a/camel-example-spring-boot-rabbitmq/pom.xml +++ b/camel-example-spring-boot-rabbitmq/pom.xml @@ -81,6 +81,11 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-actuator</artifactId> </dependency> + <!-- use spring rabbitmq --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-amqp</artifactId> + </dependency> <!-- Camel --> <dependency> @@ -89,7 +94,7 @@ </dependency> <dependency> <groupId>org.apache.camel.springboot</groupId> - <artifactId>camel-rabbitmq-starter</artifactId> + <artifactId>camel-spring-rabbitmq-starter</artifactId> </dependency> <!-- test --> @@ -121,18 +126,6 @@ </execution> </executions> </plugin> - - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-maven-plugin</artifactId> - <version>${camel-version}</version> - <!-- allows to fail if not all routes are fully covered during testing --> - <!-- - <configuration> - <failOnError>true</failOnError> - </configuration> - --> - </plugin> </plugins> </build> </project> diff --git a/camel-example-spring-boot-rabbitmq/src/main/java/sample/camel/SampleCamelRouter.java b/camel-example-spring-boot-rabbitmq/src/main/java/sample/camel/SampleCamelRouter.java index 5937a38..49183d7 100644 --- a/camel-example-spring-boot-rabbitmq/src/main/java/sample/camel/SampleCamelRouter.java +++ b/camel-example-spring-boot-rabbitmq/src/main/java/sample/camel/SampleCamelRouter.java @@ -31,9 +31,9 @@ public class SampleCamelRouter extends RouteBuilder { public void configure() throws Exception { from("timer:hello?period=1000") .transform(simple("Random number ${random(0,100)}")) - .to("rabbitmq:foo"); + .to("spring-rabbitmq:foo?routingKey=mykey"); - from("rabbitmq:foo") + from("spring-rabbitmq:foo?queues=myqueue&routingKey=mykey") .log("From RabbitMQ: ${body}"); } diff --git a/camel-example-spring-boot-rabbitmq/src/main/resources/application.properties b/camel-example-spring-boot-rabbitmq/src/main/resources/application.properties index 613e5f8..bbe7bfb 100644 --- a/camel-example-spring-boot-rabbitmq/src/main/resources/application.properties +++ b/camel-example-spring-boot-rabbitmq/src/main/resources/application.properties @@ -31,15 +31,18 @@ camel.springboot.name = SampleCamel # turn on actuator health check management.endpoint.health.enabled = true -# configure connection to the rabbit mq broker using camel-rabbitmq style -# note you can also configure from Java code, see SampleCamelApplication.java -camel.component.rabbitmq.hostname=localhost -camel.component.rabbitmq.port-number=5672 -camel.component.rabbitmq.username=guest -camel.component.rabbitmq.password=guest +# configure connection to the rabbit mq broker using spring rabbitmq style +spring.rabbitmq.host = 127.0.0.1 +spring.rabbitmq.port = 5672 +spring.rabbitmq.username = guest +spring.rabbitmq.password = guest + +# turn off auto declare if Camel should not automatic setup exchange, queue and bindings +# camel.component.spring-rabbitmq.auto-declare = false # to configure logging levels #logging.level.org.springframework = INFO #logging.level.org.apache.camel.spring.boot = INFO +#logging.level.org.springframework.amqp.rabbit = DEBUG #logging.level.org.apache.camel.impl = DEBUG #logging.level.sample.camel = DEBUG