Infinite Loop Message Consumer

While using solace jcsmp the message consumer reiceving infinity times.
Can I stop consumer and listen again for the next message

Thank you

This sounds like something very broken in your code.
First, set up a Dead Message Queue , add the " DMQ Eligible " flag to your message publisher and set the queue max-redelivery count.
You need to work out how and why messages are being redelivered. Are you acknowledging the messages?

Hi. @TomF
I am using 3 micro service
One for publish to a topic
Second for consume from that topic and publish to another two topic
Third one consume from second and save to db
While running micro service it’s not get acknowledged and consume infinitly

Thank you

I’d say you need to call acknowledge, then.

@TomF
Thank you for your patience
But the acknowledgement is not working for me
Do you have any sample code for acknowledgement?
If I need to add any settings while creating session?

Thanks

@TomF

Please find the attached images for my code

Thank you




@TomF @mabourahal @marc.dipasquale @amackenzie
Any solutions?

Thank you ?

hi @Shaz ,
Try to refer the sample codes from the github repo.
solace-samples-java/src/main/java/com/solace/samples/java/snippets at main · SolaceSamples/solace-samples-java · GitHub
There are codes to consume persistent and direct messages.

Hi @Shaz ,
Were you able to figure out the issue? Looking briefly at your code maybe on line 66 of your UniversityConsumerApplication you check if it’s a TextMessage and if it’s not it would never be acknowledged. Could that maybe be your issue?
As @jmahrok mentioned we have samples in github. Here is an example receiver that Acks the message from a queue that might be useful: solace-samples-java-jcsmp/src/main/java/com/solace/samples/jcsmp/patterns/GuaranteedSubscriber.java at master · SolaceSamples/solace-samples-java-jcsmp · GitHub
Hope that helps!