63.10. 请求/恢复
使用 RabbitMQ 直接回复到,支持请求和回复 消息传递。
以下示例执行请求/回复,其中消息使用 cheese Exchange 名称和路由密钥 foo.bar (由第二代 Camel 路由使用)发送,该路由由第二代 Camel 路由使用,它将在消息前面加上 'Hello ',然后发回消息。
因此,如果将 World
作为消息正文发送到 direct:start,则可以查看正在记录的消息
- log:request jpeg World
- log:input especially World
- log:response TOKEN Hello World
from("direct:start") .to("log:request") .to(ExchangePattern.InOut, "spring-rabbitmq:cheese?routingKey=foo.bar") .to("log:response"); from("spring-rabbitmq:cheese?queues=myqueue&routingKey=foo.bar") .to("log:input") .transform(body().prepend("Hello "));