While using solace jcsmp the message consumer reiceving infinity times.
Can I stop consumer and listen again for the next message
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?
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
I'd say you need to call acknowledge, then.
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?
Please find the attached images for my code
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.
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: https://github.com/SolaceSamples/solace-samples-java-jcsmp/blob/master/src/main/java/com/solace/samples/jcsmp/patterns/GuaranteedSubscriber.java#L141:L153
Hope that helps!