">#</a>
</h2>
<p>All the logic required to put a two-phase commit protocol together can be a little bit complicated and that&rsquo;s why Flink extracts the common logic of the two-phase commit protocol into the abstract <code>TwoPhaseCommitSinkFunction</code> class<code>. </code></p>
<p>Let&rsquo;s discuss how to extend a <code>TwoPhaseCommitSinkFunction</code> on a simple file-based example. We need to implement only four methods and present their implementations for an exactly-once file sink:</p>
<ol>
<li