The following is sync API. Async is similar
class EventData(object):
def __init__(self, body=None, to_device=None, message=None): # users shouldn't pass in message
@property
def sequence_number(self): int
@property
def offset(self): str
@property
def enqueued_time(self): datetime
@property
def device_id(self): bytes
@property
def application_properties(self): dict[str, str]
@property
def body(self): bytes or Generator[bytes]
def body_as_str(self, encoding='UTF-8'): str
def body_as_json(self, encoding='UTF-8'): dict
def encode_message(self): bytearray
class EventPosition(object):
def __init__(self, value, inclusive=False):
@staticmethod
def first_available_event():
@staticmethod
def new_events_only():
@staticmethod
def from_offset(offset, inclusive=False):
@staticmethod
def from_sequence(sequence, inclusive=False):
@staticmethod
def from_enqueued_time(enqueued_time):
class SharedKeyCredentials(object):
def __init__(self, policy, key):
class SASTokenCredentials(object):
def __init__(self, token):
class EventHubClient(EventHubClientAbstract):
def __init__(self, host, event_hub_path, credential, **kwargs):
@classmethod
def from_connection_string(cls, conn_str, eventhub=None, **kwargs):
@classmethod
def from_iothub_connection_string(cls, conn_str, **kwargs):
def create_receiver(
self, partition_id, consumer_group="$Default", event_position=None, exclusive_receiver_priority=None,
operation=None,
prefetch=None,
): Receiver
def create_sender(self, partition_id=None, operation=None, send_timeout=None): Sender
def get_properties(self): dict[str, str]
def get_partition_ids(self): list[str]
def get_partition_properties(self): dict[str, str]
class Receiver(object):
def __init__(self, client, source, event_position=None, prefetch=300, exclusive_receiver_priority=None, keep_alive=None, auto_reconnect=True):
def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
def __iter__(self):
def __next__(self):
def close(self, exception=None):
@property
def queue_size(self): int
def receive(self, max_batch_size=None, timeout=None): list[EventData]
class Sender(object):
def __init__(self, client, target, partition=None, send_timeout=60, keep_alive=None, auto_reconnect=True):
def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
def close(self, exception=None):
def send(self, event_data):