Announcement Announcement Module
Collapse
No announcement yet.
How to stop Inbound gateway from reading new messages but finish processing old ones Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment

    Working...
    X