transport

class mersal.transport.DefaultTransactionContext[source]

Bases: TransactionContext

__init__() None[source]
class mersal.transport.DefaultTransactionContextWithOwningApp[source]

Bases: DefaultTransactionContext

__init__(app: Mersal) None[source]
class mersal.transport.OutgoingMessage[source]

Bases: object

A convenience class wrapping a transport message and its destination.

__init__(destination_address: str, transport_message: TransportMessage) None
destination_address: str

Destination address for the outgoing message.

transport_message: TransportMessage

Message to be sent to the transport.

class mersal.transport.TransactionContext[source]

Bases: Protocol

__init__(*args, **kwargs)
class mersal.transport.Transport[source]

Bases: Protocol

__init__(*args, **kwargs)
async receive(transaction_context: TransactionContext) TransportMessage | None[source]

Return the next incoming message, or None if none is available.

Implementations may wait internally for a message but must return (a message or None) within a bounded time rather than blocking indefinitely: the worker treats each return as a liveness signal, and idle waiting is the job of the worker’s backoff strategy, not the transport.

class mersal.transport.TransportBridge[source]

Bases: Transport

A Transport wrapper that allows sending messages to via other transports.

__init__(default_transport: Transport, address_transport_mapping: dict[str, Transport]) None[source]

Initializes TransportBridge.

A Transport wrapper that allows sending messages to via other transports.

Parameters:
  • default_transport – The Transport to be wrapped.

  • address_transport_mapping – Sets addresses to use specific transports.

async receive(transaction_context: TransactionContext) TransportMessage | None[source]

Return the next incoming message, or None if none is available.

Implementations may wait internally for a message but must return (a message or None) within a bounded time rather than blocking indefinitely: the worker treats each return as a liveness signal, and idle waiting is the job of the worker’s backoff strategy, not the transport.