Results 1 to 2 of 2

Thread: Configuring acknowledgements for RabbitTemplate but using standard bean def

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,020

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •