我一直在尝试使用 2.12.1-SNAPSHOT 中的 RabbitMQComponent 版本让骆驼路由。这样做,我已经能够轻松消费,但在路由到另一个队列时会遇到广告问题。
CamelContext 上下文 = 新的 DefaultCamelContext(); context.addComponent("rabbit-mq", factoryComponent()); from("rabbit-mq://localhost/test.exchange&queue=test.queue&username=guest&password=guest&autoDelete=false&durable=true") .log("${in.body}") .to("rabbit-mq://localhost/out.queue&routingKey=out.queue&durable=true&autoAck=false&autoDelete=false&username=guest&password=guest") 。结尾();
在此,我已经验证了指定的交换是否配置了适当的路由密钥。我注意到我可以大量消费,但不能生产到 out.queue。
以下是对处理消息的 RabbitMQProducer 的唯一引用。
09:10:28,119 DEBUG RabbitMQProducer[main]: - 开始生产者:Producer[rabbit-mq://localhost/out.queue?autoAck=false&autoDelete=false&durable=true&password=xxxxxx&routingKey=out.queue&username=guest] 09:10:48,238 DEBUG RabbitMQProducer[Camel (camel-1) thread #11 - ShutdownTask]: - 停止生产者:Producer[rabbit-mq://localhost/out.queue?autoAck=false&autoDelete=false&durable=true&password=xxxxxx&routingKey=out .queue&username=guest]
我花了一些时间研究 RabbitMQ 组件的 Camel 单元测试,但我没有看到任何非常有价值的用途。有没有人能让这个工作?
谢谢。