我想用Rabbitmq和apache RouteBuilder配置Spring Boot应用程序,有人可以建议我怎么做
答案 0 :(得分:3)
您提到Apache骆驼RouteBuiler吗? 如果您说是,则可以使用自版本2.12以来Apache骆驼提供的RabbitMQ component。 有关更多详细信息,请检查我的示例代码:
<!-- language: lang-java -->
@Component
public class MyRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
// listen from exchange and log to console
from("rabbitmq:topic_logs2?" +
"vhost=myvhost&hostname=localhost&portNumber=5672" +
"&username=myname&password=mypassword" +
"&exchangeType=topic&autoDelete=false&queue=my_queue&routingKey=test.log")
.log("From RabbitMQ: ${body}");
}
}