If I send messages synchronously using -
producer.send(myRecord).get();
Am I guaranteed that messages will reach the respective partitions in the same order as they were sent?
Or do i still need to set the max.in.flight.requests.per.connection=1
(Currently the max.in.flight.requests.per.connection is set to be greater than one, so I need to be clear on this before I can suggest setting this to one, only if it's required. I have to recommend it only if it's mandatory).
My current understanding is -
producer.send(myRecord).get();
will also take care of retries. The next record will not be processed until the first one succeeds or fails after N retries. Only after the first record has failed or succeeded the second record will be processed/sent to the broker.
You are right, producer.send().get() should ensure ordering. The other way to ensure ordering is by setting max.in.flight.requests.per.connection=1, which allows you to async send messages, and batching can kick in, thus it is more efficient.