5

I've spun up a Pulsar Java consumer in thread T1 and I'm handing over the messages for processing to thread T2.

Is it safe to acknowledge messages from T2? Specifically, is calling consumer.acknowledge(messageId) on the instance shared between two threads ok?

David Siro
  • 1,826
  • 14
  • 33

1 Answers1

5

Yes, the java client is thread safe, so the interaction you described should be fine.

Ivan Kelly
  • 204
  • 1
  • 3
  • 1
    Do you have some reference? The javadoc seems rather brief and the [documentation][1] not explicit enough. [1]: https://pulsar.incubator.apache.org/docs/latest/clients/Java/#Consumers-j8vfvs] – Milos Gregor Jun 26 '18 at 20:10
  • 3
    @MilosGregor every class in the Pulsar Java client is thread safe. We will make it more explicit in the Javadocs – Matteo Merli Jun 26 '18 at 21:03