View Source kpro_txn_lib (kafka_protocol v4.1.9)

Summary

Functions

Send consumer group ID to transaction coordinator. Transaction coordinator will map the group ID to its internal partition number in __consumer_offsets topic. then add that topic-partition to transaction like what the add_partitions_to_txn API would achieve.
Add partitions to transaction.
Commit or abort transaction.

Types

-type connection() :: kpro:connection().
-type group_id() :: kpro:group_id().
-type offsets_to_commit() :: kpro:offsets_to_commit().
-type partition() :: kpro:partition().
-type topic() :: kpro:topic().
-type txn_ctx() :: kpro:txn_ctx().

Functions

Link to this function

add_offsets_to_txn(TxnCtx, CgId, Opts)

View Source
-spec add_offsets_to_txn(txn_ctx(), group_id(), #{timeout => timeout()}) -> ok | {error, any()}.
Send consumer group ID to transaction coordinator. Transaction coordinator will map the group ID to its internal partition number in __consumer_offsets topic. then add that topic-partition to transaction like what the add_partitions_to_txn API would achieve.
Link to this function

add_partitions_to_txn(TxnCtx, TPL, Opts)

View Source
-spec add_partitions_to_txn(txn_ctx(), [{topic(), partition()}], #{timeout => timeout()}) ->
                               ok | {error, any()}.
Add partitions to transaction.
Link to this function

end_txn(TxnCtx, AbortOrCommit, Opts)

View Source
-spec end_txn(txn_ctx(), commit | abort, #{timeout => timeout()}) -> ok | {error, any()}.
Commit or abort transaction.
Link to this function

txn_init_ctx(Connection, TxnId, Opts)

View Source

See also: kpro:txn_init_ctx/3.

Link to this function

txn_offset_commit(GrpConnection, GrpId, TxnCtx, Offsets, Opts)

View Source
-spec txn_offset_commit(connection(),
                        group_id(),
                        txn_ctx(),
                        offsets_to_commit(),
                        #{timeout => timeout(), user_data => binary()}) ->
                           ok | {error, any()}.