Announcement Announcement Module
Collapse
No announcement yet.
Timeouts waiting for responses Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Temporary Reply Queue is not getting deleted

    Originally posted by Mark Fisher View Post
    Each temporary queue should live until a reply Message is received or as long as the timeout, whichever is longer. Then, it is deleted.

    Are you actually witnessing something different?
    Hi Mark,
    Temporary Reply Queue is not getting deleted after it received the message. I'm using Spring amqp template to send and receive the message.

    Below is the code snippet

    context = new AnnotationConfigApplicationContext(RabbitConfigura tion.class);

    Queue replyQueue = (Queue)context.getBean("springAmqpQ");
    System.out.println("Reply Queue Name : " + replyQueue.getName());
    RabbitTemplate template = (RabbitTemplate)context.getBean("amqpTemplate");
    template.setReplyTimeout(120000);
    template.setReplyQueue(replyQueue);
    //template.convertAndSend(exchange, routingKey, createMessage(reportDbPing.getBytes()));
    template.send(exchange, routingKey, createMessage(reportDbPing.getBytes()));
    System.out.println("Message sent and went for a sleep.....");
    Thread.sleep(120000);
    System.out.println("Wake up from a sleep ready to consume Message");
    Message message = template.receive(replyQueue.getName());

    One more question, on how to set ack or Nack to the RabbitMq broker using AmqpTemplate? Or AmqpTemplate.receive() implicitly does autoAck??

    Thanks in advance.

    Comment


    • #17
      The template doesn't use temporary queues when you specify a replyQueue. See the java docs...

      Code:
      	/**
      	 * A queue for replies; if not provided, a temporary exclusive, auto-delete queue will
      	 * be used for each reply.
      	 *
      	 * @param replyQueue the replyQueue to set
      	 */
      However, the replyQueue (or temporary reply queue) is only used by the template when you use the ...sendAndReceive(...) methods. Also, an explicit replyQueue requires a listenerContainer to handle the replies. Ack behavior is configured on the listener container. Besides transactions, there is no way to control the ack behavior in receive().

      Comment


      • #18
        Thanks Gary,

        Originally posted by Gary Russell View Post
        The template doesn't use temporary queues when you specify a replyQueue. See the java docs...

        Code:
        	/**
        	 * A queue for replies; if not provided, a temporary exclusive, auto-delete queue will
        	 * be used for each reply.
        	 *
        	 * @param replyQueue the replyQueue to set
        	 */
        However, the replyQueue (or temporary reply queue) is only used by the template when you use the ...sendAndReceive(...) methods. Also, an explicit replyQueue requires a listenerContainer to handle the replies. Ack behavior is configured on the listener container. Besides transactions, there is no way to control the ack behavior in receive().
        Thanks Gary,

        I see the behavior as you said, as temporary queue requires Ack, I assume the autoAck is set to true on the channel.

        Comment

        Working...
        X