1

I decided to go with SCS to avoid having getting stuck with a specific message broker. Having said that, I haven't found a way to acknowledge messages whether automatically or manually, and all I've found is stuff under Spring Cloud GCP like the PubSubTemplate. Problem is my listener keeps getting the same messages over and over. Is there a way to automatically acknowledge the message as soon as it gets pulled within SCS regardless of the messaging implementation? Maybe by changing some property?

CCC
  • 2,642
  • 7
  • 40
  • 62

1 Answers1

2

Acknowledgement is automatic providing the message handler did not throw an exception. Of course a particular binder could have an issue, but that besides the point as I am sure GCP binder does not have that issue.

Basically the point I am trying to make is as you said "... go with SCS to avoid having getting stuck with. . .". I would add ". . . to avoid being stuck with manually handle messaging concerns. . .". This means ACKs/NACKs, retries, DLQs etc are all responsibility of the SCSt and Spring in general.

Yes there are edge cases where things may need to be handled manually and certain binders do expose Acknowledgement and other callbacks, but we're not there yet as I am more concern about the symptom you are describing - my listener keeps getting the same messages over and over. That is hardly possible if such listener does not throw an exception.

So, consider providing more details or better off post your sample project that reproduces the issue somewhere on GitHub so we can take a look.

Oleg Zhurakousky
  • 5,820
  • 16
  • 17
  • Yes, I apologize. Your response got me on the right track. I was listening to topic A and sending messages to B, but there was another process I didn't know that was re sending messages from topic B to topic A. I'll soon delete the question. – CCC Feb 23 '19 at 00:01
  • 1
    No, please don't delete the question. That would defeat the purpose.Let other community members benefit from it if they encounter the same/similar question – Oleg Zhurakousky Feb 25 '19 at 07:14
  • so the AKC/NACK logic is: if the method finishes without exception - ACK, else - NACK? – orirab Mar 06 '19 at 15:48