【发布时间】:2017-02-13 17:14:04
【问题描述】:
我的 Spring 集成流程是在 xml 中定义的,如下所示(请注意,由于 xml 在我的问题中没有正确显示,所以我已经删除了开始/结束字符):
<int-amqp:channel id="actionInstructionTransformed" message-driven="false"/>
<int-xml:unmarshalling-transformer
input-channel="actionInstructionXmlValid" output-channel="actionInstructionTransformed"
unmarshaller="actionInstructionMarshaller" />
我定义了一个轮询器:
<int:poller id="customPoller" default="true" trigger="customPeriodicTrigger" task-executor="customTaskExecutor" max-messages-per-poll="${poller.maxMessagesPerPoll}" error-channel="drsGatewayPollerError" />
<int:transactional propagation="REQUIRED" read-only="true" transaction-manager="transactionManager" />
</int:poller>
在 Java 中,我定义了我的消费者:
@Transactional(propagation = Propagation.REQUIRED, readOnly = true, value = "transactionManager")
@ServiceActivator(inputChannel = "actionInstructionTransformed", poller = @Poller(value = "customPoller"),
adviceChain = "actionInstructionRetryAdvice")
public final void processInstruction(final ActionInstruction instruction)
根据文档 (http://docs.spring.io/autorepo/docs/spring-integration/4.0.2.RELEASE/reference/html/amqp.html),我了解到 actionInstructionTransformed 应该是可轮询的,因为我添加了 message-driven="false"。
运行我的 Spring Boot 应用程序时,我收到异常:原因:java.lang.IllegalStateException:不应为基于注释的端点指定“@Poller”,因为“actionInstructionTransformed”是一个 SubscribableChannel(不可轮询) )。
我正在使用 Spring Boot 1.4.4.RELEASE。
如何强制 actionInstructionTransformed 被识别为可轮询?
【问题讨论】:
-
StackOverflow 中有
code格式化功能:stackoverflow.com/editing-help。只有在那之后,我们才会回来为您提供帮助
标签: spring-integration spring-amqp