Home Explore Blog CI



postgresql

17th chunk of `doc/src/sgml/logicaldecoding.sgml`
64c04dd1294215a905935edfcbe689228edfe8d7f8fe05e80000000100000fa0
 id="logicaldecoding-output-plugin-stream-stop">
     <title>Stream Stop Callback</title>
     <para>
      The required <function>stream_stop_cb</function> callback is called when
      closing a block of streamed changes from an in-progress transaction.
<programlisting>
typedef void (*LogicalDecodeStreamStopCB) (struct LogicalDecodingContext *ctx,
                                           ReorderBufferTXN *txn);
</programlisting>
     </para>
    </sect3>

    <sect3 id="logicaldecoding-output-plugin-stream-abort">
     <title>Stream Abort Callback</title>
     <para>
      The required <function>stream_abort_cb</function> callback is called to
      abort a previously streamed transaction.
<programlisting>
typedef void (*LogicalDecodeStreamAbortCB) (struct LogicalDecodingContext *ctx,
                                            ReorderBufferTXN *txn,
                                            XLogRecPtr abort_lsn);
</programlisting>
     </para>
    </sect3>

    <sect3 id="logicaldecoding-output-plugin-stream-prepare">
     <title>Stream Prepare Callback</title>
     <para>
      The <function>stream_prepare_cb</function> callback is called to prepare
      a previously streamed transaction as part of a two-phase commit. This
      callback is required when the output plugin supports both the streaming
      of large in-progress transactions and two-phase commits.
      <programlisting>
typedef void (*LogicalDecodeStreamPrepareCB) (struct LogicalDecodingContext *ctx,
                                              ReorderBufferTXN *txn,
                                              XLogRecPtr prepare_lsn);
</programlisting>
     </para>
    </sect3>

    <sect3 id="logicaldecoding-output-plugin-stream-commit">
     <title>Stream Commit Callback</title>
     <para>
      The required <function>stream_commit_cb</function> callback is called to
      commit a previously streamed transaction.
<programlisting>
typedef void (*LogicalDecodeStreamCommitCB) (struct LogicalDecodingContext *ctx,
                                             ReorderBufferTXN *txn,
                                             XLogRecPtr commit_lsn);
</programlisting>
     </para>
    </sect3>

    <sect3 id="logicaldecoding-output-plugin-stream-change">
     <title>Stream Change Callback</title>
     <para>
      The required <function>stream_change_cb</function> callback is called
      when sending a change in a block of streamed changes (demarcated by
      <function>stream_start_cb</function> and <function>stream_stop_cb</function> calls).
      The actual changes are not displayed as the transaction can abort at a later
      point in time and we don't decode changes for aborted transactions.
<programlisting>
typedef void (*LogicalDecodeStreamChangeCB) (struct LogicalDecodingContext *ctx,
                                             ReorderBufferTXN *txn,
                                             Relation relation,
                                             ReorderBufferChange *change);
</programlisting>
     </para>
    </sect3>

    <sect3 id="logicaldecoding-output-plugin-stream-message">
     <title>Stream Message Callback</title>
     <para>
      The optional <function>stream_message_cb</function> callback is called when
      sending a generic message in a block of streamed changes (demarcated by
      <function>stream_start_cb</function> and <function>stream_stop_cb</function> calls).
      The message contents for transactional messages are not displayed as the transaction
      can abort at a later point in time and we don't decode changes for aborted
      transactions.
<programlisting>
typedef void (*LogicalDecodeStreamMessageCB) (struct LogicalDecodingContext *ctx,
                                              ReorderBufferTXN *txn,
                                              XLogRecPtr message_lsn,
                                              bool transactional,
                                              const char *prefix,

Title: Logical Decoding Output Plugin Callbacks for Streaming Changes and Messages
Summary
This section describes several callbacks for logical decoding output plugins related to streaming changes and messages, including stream stop, stream abort, stream prepare, stream commit, stream change, and stream message, which allow plugins to handle various aspects of transaction streaming and message processing.