【问题标题】:No poller has been defined for endpoint outbound adapter没有为端点出站适配器定义轮询器
【发布时间】:2014-06-04 10:43:52
【问题描述】:

我收到了这个错误

“没有为端点'importExchangesOutboundAdapter'定义轮询器”。下面是我对 Spring 批量远程分块的配置。

我正在使用 spring 集成 amqp。

<rabbit:connection-factory id="connectionFactory"
    port="${rabbitmq.port}" host="${rabbitmq.host}" username="${rabbitmq.username}"
    password="${rabbitmq.password}" />

<rabbit:template id="amqpTemplate"
    connection-factory="connectionFactory">
</rabbit:template>

<rabbit:queue name="${import.exchanges.queue}" />
<rabbit:queue name="${import.exchanges.reply.queue}" />

<int:channel id="importExchangesChannel">
    <int:queue />
</int:channel>


<int:channel id="importExchangesReplyChannel">
    <int:queue />
</int:channel>


<beans:bean id="importExchangesMessagingTemplate"
    class="org.springframework.integration.core.MessagingTemplate"
    p:defaultChannel-ref="importExchangesChannel" p:receiveTimeout="${import.exchanges.reply.timeout}">
</beans:bean>

<amqp:outbound-channel-adapter id="importExchangesOutboundAdapter"
    channel="importExchangesChannel" />

<amqp:inbound-channel-adapter id="importExchangesInboundAdapter"
    connection-factory="connectionFactory" channel="importExchangesReplyChannel"
    queue-names="${import.exchanges.reply.queue}" />


<beans:bean id="importExchangesChunkItemWriter"
    class="org.springframework.batch.integration.chunk.ChunkMessageChannelItemWriter"
    scope="step" p:messagingOperations-ref="importExchangesMessagingTemplate"
    p:replyChannel-ref="importExchangesReplyChannel">
</beans:bean>

<beans:bean id="importExchangesChunkHandler"
    class="org.springframework.batch.integration.chunk.RemoteChunkHandlerFactoryBean"
    p:chunkWriter-ref="importExchangesChunkItemWriter" p:step-ref="importExchangesStep">
</beans:bean>

<amqp:inbound-channel-adapter id="importExchangesSlaveInboundAdapter"
    connection-factory="connectionFactory" channel="${import.exchanges.queue}Channel"
    queue-names="${import.exchanges.queue}" />



<amqp:outbound-channel-adapter id="importExchangesSlaveOutboundAdapter"
    channel="importExchangesReplyChannel" />

<int:service-activator id="serviceActivatorExchanges"
    input-channel="importExchangesChannel" output-channel="importExchangesReplyChannel"
    ref="chunkProcessorChunkHandlerExchanges" method="handleChunk" />

<beans:bean id="chunkProcessorExchanges"
    class="org.springframework.batch.core.step.item.SimpleChunkProcessor"
    p:itemWriter-ref="importExchangesItemWriter" />

<beans:bean id="chunkProcessorChunkHandlerExchanges"
    class="org.springframework.batch.integration.chunk.ChunkProcessorChunkHandler"
    p:chunkProcessor-ref="chunkProcessorExchanges" />

【问题讨论】:

    标签: spring spring-batch spring-integration spring-amqp


    【解决方案1】:

    您定义的端点importExchangesOutboundAdapter 具有通道importExchangesChannel 来轮询消息,因为该通道是Queue 通道,需要配置轮询器以进行消息消费。

    简单的答案是定义一个全局轮询器,如下所示:

    <int:poller default="true" fixed-delay="100"/>
    

    【讨论】:

    • 频道定义没有队列。抱歉没有明白你所说的“频道是队列”的意思
    • 是的,确实如此。您可以从该通道中删除 &lt;int:queue/&gt; 子元素,或将轮询器添加到出站适配器(或按照 Rajesh 的建议定义全局轮询器)。但是一般不需要对出站请求进行排队,所以只删除子元素是最简单的。
    猜你喜欢
    • 2015-11-11
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-16
    • 1970-01-01
    • 2018-08-07
    • 2014-08-22
    相关资源
    最近更新 更多