Skip to content

Add transaction and connection APIs - #250

Merged
ono merged 2 commits into
mainfrom
amqp-api-gaps
Oct 6, 2026
Merged

ono merged 2 commits into
mainfrom
amqp-api-gaps

Conversation

@ono

@ono ono commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Add the following APIs while preserving existing defaults and return values. No version bump.

New APIs

API Behavior
AMQP.Transaction.select(channel) Enable transaction mode
AMQP.Transaction.commit(channel) Commit pending publishes and acknowledgements
AMQP.Transaction.rollback(channel) Roll back pending publishes and acknowledgements
AMQP.Connection.info(connection, keys) Return requested information as a keyword list; reject invalid keys with ArgumentError without closing the connection
AMQP.Connection.info_keys() List information keys common to all connections
AMQP.Connection.info_keys(connection) List information keys for this connection
AMQP.Connection.connection_name(connection) Return the configured name or :undefined
AMQP.Connection.register_blocked_handler(connection, pid) Forward {:"connection.blocked", reason} and {:"connection.unblocked"} notifications
AMQP.Connection.close(connection, timeout) Close with a timeout in milliseconds
AMQP.Connection.close(connection, code, text) Close with a custom reply code and text
AMQP.Connection.close(connection, code, text, timeout) Close with a custom reply code, text, and timeout in milliseconds
AMQP.Channel.close(channel, code, text) Close with a custom reply code and text
AMQP.Queue.purge(channel, queue, options) Purge with optional :nowait or :no_wait
AMQP.Confirm.select(channel, options) Enable confirms with optional :nowait or :no_wait

New Options

  • :nowait and its alias :no_wait default to false for queue purge and confirm selection. Setting either to true skips the broker reply and returns :ok after sending the request.
  • Existing Queue.purge/2 still returns the message count; Confirm.select/1 still waits for the broker reply.

Internal AMQP.Core record macros added: tx_select, tx_select_ok, tx_commit, tx_commit_ok, tx_rollback, and tx_rollback_ok.

Blocked-handler documentation covers the upstream monitor limitation when replacing handlers.

Validation: 84 tests pass with amqp_client 4.3.4 and 4.2.1; formatting and diff checks pass.

@ono
ono merged commit d177f3c into main Oct 6, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant