Ermintar
Ermintar

Reputation: 1393

Camel connect to RabbitMQ queue with extra params

I want to integratate Camel route with RabbitMQ via xml- configuration.

I need to listen to messages from MYPRETTYQ, that already exists in Rabbiit.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">


<camelContext id="camelId" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="rabbitmq://localhost:5672/direct?queue=MYPRETTYQ&autoDelete=false&skipQueueDeclare=true"/>
        <log message="File: ${body}"/>
    </route>
</camelContext>

Params were taken from https://camel.apache.org/rabbitmq.html

However the '&' symbol is not parsed in uri string and I get the following exception:

 Caused by: org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 91; The reference to entity "autoDelete" must end with the ';' delimiter.

I tried changing '&' to ';' however it causes invalid behavior. Instead of beeing parsed to params the line

queue=MYPRETTYQ;autoDelete=false;skipQueueDeclare=true 

creates a new queue with such a name.

I'm at a loss, because all URI examples show that using '&' is the correct way of passing params. Any help appreciated

Upvotes: 1

Views: 494

Answers (1)

Abdullah G
Abdullah G

Reputation: 157

 you should replace & to &amp;

Upvotes: 3

Related Questions