如何强制Rabbit MQ再次累积和发送消息?

时间:2016-05-23 22:55:16

标签: java spring rabbitmq spring-integration

我在XML文件中配置了几个Spring-Integration元素(见下文) 从amqp通道适配器,消息被定向到具有实现integrationRouterImpl的路由器integrationSecondaryRouter。

如果在integrationRouterImpl中存在未捕获的异常,我希望Rabbit MQ将一次又一次地发送消息。但是,这不会发生。 Rabbit MQ监视器不显示任何消息累积。我的配置出错?

<int-amqp:inbound-channel-adapter 
    channel="integrationFrontDoorQueueChannel" 
    queue-names="${integration.creation.orders.queue.name}" 
    header-mapper="integrationHeaderMapper"
    connection-factory="connectionFactory" 
    error-channel="errorChannel" 
/>

<int:chain 
        id="integrationFrontDoorQueueChain" 
        input-channel="integrationFrontDoorQueueChannel"
        output-channel="integrationRouterChannel">
    <int:transformer ref="integrationJsonPayloadTransformer" method="transformMessagePayload"/>
    <int:filter ref="integrationNonDigitalCancellationFilter" method="filter"/>
    <int:filter ref="integrationPartnerFilter" method="filter"/>
    <int:filter ref="integrationOrderDtoDgcAndGoSelectFilter" method="filter"/>

</int:chain>

 <int:header-value-router 
    id="integrationPrimaryRouter"
    input-channel="integrationRouterChannel" 
    default-output-channel="integrationFrontDoorRouterChannel"
    resolution-required="false"
    header-name="#{T(com.smartdestinations.constants.SdiConstants).INTEGRATION_PAYLOAD_ACTION_HEADER_KEY}">
    <int:mapping 
        value="#{T(com.smartdestinations.service.integration.dto.IntegrationAction).EXCLUSION_SCAN.name()}" 
        channel="integrationExclusionChannel" 
    />
</int:header-value-router>


<int:router 
        id="integrationSecondaryRouter"
        ref="integrationRouterImpl" 
        input-channel="integrationFrontDoorRouterChannel"
        method="route" 
        resolution-required="false" 
        default-output-channel="nullChannel"
/>

1 个答案:

答案 0 :(得分:2)

看,你有error-channel="errorChannel"Documentation就此问题指出:

  

默认的“errorChannel”是PublishSubscribeChannel。

是的,有一个订阅者。但它只是_org.springframework.integration.errorLogger

由于没有人将您的例外重新投放到SimpleMessageListenerContainer,因此没有理由nack发送消息并再次重新发送。