Try using ack=AUTO
, but set the prefetch
and txSize
to, say 1000; that way, an ack will only be sent every 1000 messages (you can tune this value as needed).
Using ackmode=NONE causes messages to accumulate in an unbounded blocking queue within the listener container and will only work if the listener can keep up (OOM means yours can't).
We have an open JIRA issue to resolve this for ack=NONE, but the above technique is usually sufficient.
You can also improve throughput using the container concurrency settings.