From the docs:
By default, foreachBatch provides only at-least-once write guarantees. However, you can use the batchId provided to the function as way to deduplicate the output and get an exactly-once guarantee.
Does this mean that unless we go the extra mile, we wouldn't achieve exactly-once write guaranty even if we use checkpointing in the main writeStream operation?
If yes, what should be done to achieve exactly-once write guaranty? What is meant in the docs by:
using the batchId ?
PS: The original question was specific for Kafka but I generalized it as the solution would apply to anything within the foreachBatch block.