I have some code after the consumer consumes, right now since the message queue is asynchronous the flow will continue even if the message is not consumed by the consumer. I want to wait till the consumer receives the message and till then the flow needs to be paused. Is there any way to do it? I'm using RabbitMQ Java implementation and I'm using topic exchange.
Asked
Active
Viewed 340 times
1
-
Why do you think the messages are not paused? They are paused until you dont fetch more messages. – Santosh b Jul 21 '20 at 09:30
-
After the message consumption I have some functions running that are dependent on the value of message received. So I want to wait till the message comes or else the message value will be null(since message has not been consumed). – Akshay Jul 21 '20 at 09:36
-
Dont acknowledge until your processing is done. In that case consumer will not poll for new messages – Santosh b Jul 21 '20 at 10:05
-
By `pausing the flow`, do you mean the producer should stop producing until the consumer consumes? If so, queue based messaging is the wrong fit for your problem - you want an RPC style integration like REST or SOAP. – StuartLC Jul 21 '20 at 12:33
1 Answers
0
In your case you can make your Queue a Lazy queue so that message will be stored on disk until the consumer comes back and picks your messages.

Rajesh Babu Devabhaktuni
- 19
- 1
- 9