我想通过xml配置将Camel路由与RabbitMQ集成。
我需要收听已经存在于拉比特的MYPRETTYQ的消息。
<?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取自https://camel.apache.org/rabbitmq.html
然而&#39;&amp;&#39;在uri字符串中没有解析符号,我得到以下异常:
Caused by: org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 91; The reference to entity "autoDelete" must end with the ';' delimiter.
我尝试过改变&#39;&amp;&#39;到&#39;;&#39;但它会导致无效行为。而不是解析为params线
queue=MYPRETTYQ;autoDelete=false;skipQueueDeclare=true
创建一个具有此名称的新队列。
我不知所措,因为所有URI示例都显示使用&#39;&amp;&#39;是传递params的正确方法。任何帮助表示赞赏
答案 0 :(得分:2)
you should replace & to &