【问题标题】:confirm-ack-channel is not getting invoked确认确认通道没有被调用
【发布时间】:2016-04-11 07:15:21
【问题描述】:

以下是我的配置。如果成功发布到队列,则流程不会传递到确认确认通道。谁能指出哪里出错了?

<int-amqp:outbound-channel-adapter channel="fulfillmentOutboundChannel"
                                   routing-key="xyz"
                                   amqp-template="transactionalRabbitTemplate"
                                   confirm-correlation-expression="payload"
                                   confirm-ack-channel="successRespTransformChannel"
                                   confirm-nack-channel="failureRespTransformChannel"
                                   return-channel="failureRespTransformChannel"
                                   mapped-request-headers="*"


        />


<int:channel id="successRespTransformChannel">

    <int:interceptors><int:wire-tap channel="loggerChannel"/></int:interceptors>
</int:channel>

<chain input-channel="successRespTransformChannel">
    <int:header-enricher>
    <error-channel ref="failed-publishing" />
    </int:header-enricher>
    <service-activator id="successResp" expression="@abc.addRequestTracking(payload.id,'success')"/>

</chain>

【问题讨论】:

    标签: spring-integration spring-amqp


    【解决方案1】:

    为了得到acks/nacks,除了用confirm-correlation设置适配器,还需要在CachingConnectionFactory上启用publisherConfirms

    来自the documentation

    对于发布者确认(又名发布者确认),模板需要将其 publisherConfirms 属性设置为 true 的 CachingConnectionFactory。

    【讨论】:

    • 感谢您的回复 Gary。我已经将 publisg-confirms=true 设置为如下。仍然没有调用 ack
    • 否决票 接受 感谢您的回复加里。我已经做出了 publish-confirms=true 如下..
    • 仍然无法正常工作。我的服务激活器没有被调用。
    【解决方案2】:

    感谢您的回复加里。我已经做出了 publish-confirms=true 如下..

    <rabbit:connection-factory id="fufillConnectionFactory"
    
     connection-factory="rabbitClientConnectionFactory"
                                   publisher-confirms="true"
                                   publisher-returns="true"/>
    
    
        <bean id="rabbitClientConnectionFactory" class="com.rabbitmq.client.ConnectionFactory" >
            <property name="uri" value="${mq.uri}" />
            <property name="requestedHeartbeat" value="30" />
        </bean>
    

    【讨论】:

    • 不要为此使用新答案,而是编辑问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-10
    • 1970-01-01
    • 2014-06-26
    • 2017-04-29
    相关资源
    最近更新 更多