IPWorks IoT 2020 Python Edition

Questions / Feedback?

enable_transaction_mode Method

Enables transaction mode for a channel.

Syntax

def enable_transaction_mode(channel_name: str) -> None: ...

Remarks

This method enables transaction mode for the channel with the given ChannelName.

While a channel is in transaction mode, all messages published and acknowledgements sent over it will be part of a transaction, and the server will wait to process them until the transaction is either committed or rolled back.

To commit the current transaction on a channel, call commit_transaction; and to roll it back (and discard the messages and acknowledgements that were part of it), call rollback_transaction.

Keep in mind that, according to the AMQP 0.9.1 specification:

  • A new transaction is always started immediately after committing or rolling back the current one, which means that...
  • ...a channel will stay in transaction mode, once enabled, until it is deleted.
  • Transactions are only guaranteed to be atomic if all messages published and acknowledgements sent affect a single queue.
  • Any messages published on a channel in transaction mode that have the Mandatory or Immediate flags set are not guaranteed to be included in the transaction.

An exception is thrown if no channel with the given ChannelName exists, or if enable_publish_confirms has been called for the specified channel previously.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Python Edition - Version 20.0 [Build 8265]