Announcement Announcement Module
Collapse
No announcement yet.
Configuring acknowledgements for RabbitTemplate but using standard bean def Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring acknowledgements for RabbitTemplate but using standard bean def

    We are using RPC pattern with Rabbit AMQP, and have the following bean declarations:

    <bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection. CachingConnectionFactory">
    <constructor-arg type="com.rabbitmq.client.ConnectionFactory">
    <bean id="nativeRabbitConnectionFactory" class="com.rabbitmq.client.ConnectionFactory">
    <property name="host" value="${project.hostname}" />
    <property name="port" value="${project.port}" />
    <property name="virtualHost" value="${project.vhost}" />
    <property name="username" value="${project.username}" />
    <property name="password" value="${project.password}" />
    <property name="requestedHeartbeat" value="${project.heartbeat:30}" />
    </bean>
    </constructor-arg>
    <property name="channelCacheSize" value="${project.channel.cache.size}"/>
    </bean>

    <bean id="amqpGetOrderRabbitTemplate" class="org.springframework.amqp.rabbit.core.Rabbit Template">
    <property name="connectionFactory" ref="rabbitConnectionFactory" />
    <property name="messageConverter" ref="jaxbMessageConverter" />
    <property name="exchange" value="request.exchange" />
    <property name="routingKey" value="order" />
    <property name="replyTimeout" value="60000" />
    </bean>

    We call the RabbitTemplate convertSendAndReceive() methods, and want to change the acknowledge mode on the reply messages.

    Is there any way to do change the acknowledgement mode for the replies in XML? The only option I found would be to create a SimpleMessageListenerContainer as was posted here http://forum.springsource.org/showth...-configuration and do it there using replyContainer.setAcknowledgeMode(AcknowledgeMode. NONE)

    Thanks in advance.

  • #2
    Please use [ code ] ... [ /code ] tags around config (no spaces inside brackets).

    The default RabbitTemplate uses a temporary reply queue for each request, and autoAck (NONE) is set on those consumers and there is no way to configure it. See doSendAndReceiveWithTemporary.

    As you say, if you use an explicit reply queue, you can control the acks using the reply-listener configuration.

    Comment

    Working...
    X