AsyncReceiver Class

Implements the async API of a Receiver.

Inheritance
AsyncReceiver

Constructor

AsyncReceiver(client, source, offset=None, prefetch=300, epoch=None, keep_alive=None, auto_reconnect=True, loop=None)

Parameters

client
source
offset
default value: None
prefetch
default value: 300
epoch
default value: None
keep_alive
default value: None
auto_reconnect
default value: True
loop
default value: None

Methods

close_async

Close down the handler. If the handler has already closed, this will be a no op. An optional exception can be passed in to indicate that the handler was shutdown due to error.

has_started

Whether the handler has completed all start up processes such as establishing the connection, session, link and authentication, and is not ready to process messages. This function is now deprecated and will be removed in v2.0+.

open_async

Open the Receiver using the supplied conneciton. If the handler has previously been redirected, the redirect context will be used to create a new handler before opening it.

receive

Receive events asynchronously from the EventHub.

reconnect_async

If the Receiver was disconnected from the service with a retryable error - attempt to reconnect.

close_async

Close down the handler. If the handler has already closed, this will be a no op. An optional exception can be passed in to indicate that the handler was shutdown due to error.

async close_async(exception=None)

Parameters

exception
Exception
default value: None

An optional exception if the handler is closing due to an error.

has_started

Whether the handler has completed all start up processes such as establishing the connection, session, link and authentication, and is not ready to process messages. This function is now deprecated and will be removed in v2.0+.

async has_started()

Return type

open_async

Open the Receiver using the supplied conneciton. If the handler has previously been redirected, the redirect context will be used to create a new handler before opening it.

async open_async()

Parameters

connection
Required

The underlying client shared connection.

receive

Receive events asynchronously from the EventHub.

async receive(max_batch_size=None, timeout=None)

Parameters

max_batch_size
int
default value: None

Receive a batch of events. Batch size will be up to the maximum specified, but will return as soon as service returns no new events. If combined with a timeout and no events are retrieve before the time, the result will be empty. If no batch size is supplied, the prefetch size will be the maximum.

timeout
default value: None

Return type

reconnect_async

If the Receiver was disconnected from the service with a retryable error - attempt to reconnect.

async reconnect_async()