【发布时间】:2016-02-15 15:53:45
【问题描述】:
我是 Spring Integration 的新手,也许这个问题是微不足道的。我正在查看示例 (https://github.com/spring-projects/spring-integration-samples/tree/master/basic/amqp) 从标准输入创建 RabbitMq 消息:
<int-stream:stdin-channel-adapter id="consoleIn"
channel="toRabbit">
<int:poller fixed-delay="1000" max-messages-per-poll="1" />
</int-stream:stdin-channel-adapter>
<int:channel id="toRabbit" />
<int-amqp:outbound-channel-adapter
channel="toRabbit" amqp-template="amqpTemplate"
exchange-name-expression="payload.toLowerCase() == 'nack' ? 'badExchange' : 'si.test.exchange'"
routing-key-expression="payload.toLowerCase() == 'fail' ? 'badKey' : 'si.test.binding'"
confirm-correlation-expression="payload"
confirm-ack-channel="good"
confirm-nack-channel="errors"
return-channel="returns" />
如果我们需要使用 Java 代码生成自定义消息怎么办。什么是适当的优雅代码?填充消息的 bean 被简化:
package com.mycompany.domain.price;
public class UpdateMessage implements Serializable {
Date effStartDate;
Date effEndDate;
Long orderId = -1;
String customerFullName;
...
}
【问题讨论】:
标签: java spring rabbitmq spring-integration