Camel routing not working as expected

Dzmitry Zahusta

I try to create a very simple route between one rabbit queue and another one. Message should go with no processing from one queue to the second. But for unknown reason the message is redirected to the first queue again and again instead of going to the second one.

@Component
public class CamelRouter extends SpringRouteBuilder {
    @Override
    public void configure() {
        from("rabbitmq://localhost/test-in?autoAck=false&autoDelete=false&durable=true&exchangeType=fanout&queue=test-in&username=guest&password=xxx")
        .log(LoggingLevel.ERROR, "Output of message from Queue: ${in.body}")
        .to("rabbitmq://localhost/test-out?autoAck=false&autoDelete=false&durable=true&exchangeType=fanout&queue=test-out&username=guest&password=xxx");
    }
}

The logs are following:

09:04:18.564 [thread] WARN  route1                                     - Output of message from Queue: test
09:04:18.700 [thread] WARN  route1                                     - Output of message from Queue: test
09:04:18.835 [thread] WARN  route1                                     - Output of message from Queue: test
09:04:18.968 [thread] WARN  route1                                     - Output of message from Queue: test
09:04:19.104 [thread] WARN  route1                                     - Output of message from Queue: test
09:04:19.238 [thread] WARN  route1                                     - Output of message from Queue: test

What is wrong is this camel configuration? It's as simple as possible in my opinion.

stringy05

Instead of removing the headers, it's better to use the out message on the exchange as shown below. In this particular example the rabbitmq prefix is probably ok, however if you try this approach with other components (imap is a great example) it wont work for all sorts of strange reasons.

    from("rabbitmq://localhost/test-in?autoAck=false&autoDelete=false&durable=true&exchangeType=fanout&queue=test-in&username=guest&password=xxx")
        .log(LoggingLevel.ERROR, "Output of message from Queue: ${in.body}")
        .process(new Processor() {

            @Override
            public void process(Exchange exchange) throws Exception {
                exchange.getOut().setBody(exchange.getIn().getBody());                  
            }
        })
        .to("rabbitmq://localhost/test-out?autoAck=false&autoDelete=false&durable=true&exchangeType=fanout&queue=test-out&username=guest&password=xxx");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Camel routing not working as expected

From Dev

Routing not working as expected in CodeIgniter

From Dev

Camel Spring DSL is not working as expected

From Dev

Deep Routing not working as expected ui-router

From Dev

rails routing not working as expected when in another controller

From Dev

Rails Routing with Constraint Class not working like expected

From Dev

MVC Routing: route precedence not working as expected

From Dev

Asp.Net MVC Routing not working as expected in 5.1

From Dev

Apache Camel Routing performance

From Dev

Camel routing from a ByteArrayInputStream

From Dev

apache camel routing queues issue

From Dev

Camel exception routing in a split EIP

From Dev

Configuring Camel Routing for Grails 3.0.4

From Dev

MARKed packets not routing as expected

From Dev

"NOT IN" not working as expected

From Dev

Camel message redelivery not behaving as expected

From Dev

Camel message redelivery not behaving as expected

From Dev

Camel useOriginalMessage not working

From Dev

Camel useExponentialBackoff not working correctly

From Dev

Camel Restlet not working in jar

From Dev

rails routing not going to controller as expected

From Dev

Laravel routing behavior with PJAX not as expected

From Dev

Camel Routing from AMQP to RESTful endpoint

From Dev

Apache Camel http routing with no connection caching

From Dev

Camel AQ routing error TypeConversionException at Xpath

From Dev

Routing not working in angular 2

From Dev

How is this Rails routing working?

From Dev

Simple AngularJS routing not working

From Dev

URI routing codigniter not working