Results 1 to 2 of 2

Thread: How to stop Inbound gateway from reading new messages but finish processing old ones

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    Question How to stop Inbound gateway from reading new messages but finish processing old ones

    Hi,

    I need to be able to stop consuming new messages from request-channel, but still be able to finish work in progress and send it to reply-channel. Is it possible by calling stop() method or will it stop the listener on the reply channel as well?

    <int-amqp:inbound-gateway request-channel="incomingMessages" ..................
    reply-channel="outgoingMessages"
    />

    What is the preferred way to accomplish this?

    Can I just define a listener on the incoming channel and disable reading by returning false from implemented preReceive(MessageChannel channel) method? Will the messages stay in the queue if the channel's listener returns false from preReceive()? Are there any negative effects related to defining the listener on the gateway?

    Thanks

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,137

    Default

    If you are NOT using transactions, I think it should work. Although the container is stopped, any 'active' threads will be sitting in the gateway waiting for the reply, which will then be sent on a different channel using an internal RabbitTemplate.

    It should be easy enough to test, just put a sleep in the downstream flow, stop the container, and watch what happens.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

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