Skip to content

EventhubsClient

Attributes

SendEventsInput module-attribute

SendEventsInput = List['SendEvent | Mapping[str, Any]']

TRIGGER_OPERATIONS module-attribute

TRIGGER_OPERATIONS: Dict[str, Dict[str, Any]] = {'OnNewEvents': {'operation_id': 'OnNewEvents', 'path': '/{connectionId}/{eventHubName}/events/batch/head', 'method': 'get', 'required_parameters': ['eventHubName'], 'callback_payload_type': 'Event'}}

Classes

Event dataclass

Event(*, content_data: Optional[ObjectEntity | Mapping[str, Any]] = None, properties: Optional[Dict[str, ObjectEntity | Mapping[str, Any]]] = None, system_properties: Optional[SystemProperties | Mapping[str, Any]] = None)

Response for When events are available in Event Hub

Attributes

properties class-attribute instance-attribute
properties: Optional[Dict[str, ObjectEntity | Mapping[str, Any]]] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'Properties'})

Key-value pairs for each application property

ObjectEntity dataclass

ObjectEntity(*, additional_properties: Dict[str, Any] = dict())

Response for Generate event schema

Attributes

additional_properties class-attribute instance-attribute
additional_properties: Dict[str, Any] = dataclass_field(default_factory=dict, kw_only=True)

Dynamic properties determined at runtime (similar to .NET [JsonExtensionData])

SystemProperties dataclass

SystemProperties(*, enqueued_time_utc: Optional[str] = None, offset: Optional[str] = None, partition_key: Optional[str] = None, sequence_number: Optional[int] = None)

Definition: SystemProperties

Attributes

enqueued_time_utc class-attribute instance-attribute
enqueued_time_utc: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'EnqueuedTimeUtc'})

Enqueued time

offset class-attribute instance-attribute
offset: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'Offset'})

Offset in a partition

partition_key class-attribute instance-attribute
partition_key: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'PartitionKey'})

Partition Key

sequence_number class-attribute instance-attribute
sequence_number: Optional[int] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'SequenceNumber'})

Sequence number

SendEvent dataclass

SendEvent(*, content_data: Optional[str] = None, properties: Optional[Dict[str, ObjectEntity | Mapping[str, Any]]] = None)

Definition: SendEvent

Attributes

content_data class-attribute instance-attribute
content_data: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'ContentData'})

Content of the event

properties class-attribute instance-attribute
properties: Optional[Dict[str, ObjectEntity | Mapping[str, Any]]] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'Properties'})

Key-value pairs for each application property

EventhubsClient

EventhubsClient(connection_runtime_url: str, credential: AsyncTokenCredential | AzureKeyCredential, *, max_retry_attempts: int = 3, timeout: float = 30.0, use_exponential_backoff: bool = True, initial_retry_delay_seconds: float = 0.5, maximum_retry_delay_seconds: float = 120.0, retry_jitter_factor: float = 0.1, retry_unsafe_http_methods: bool = False, transport: Optional[AsyncHttpTransport] = None, **kwargs: Any)

Bases: ConnectorClientBase

Typed client for eventhubs connector.

Initialize a EventhubsClient.

Parameters:

Name Type Description Default
connection_runtime_url str

The connection runtime URL from Azure Portal.

required
credential AsyncTokenCredential | AzureKeyCredential

Caller-owned Azure Core credential.

required
max_retry_attempts int

The maximum number of request attempts.

3
timeout float

The network timeout in seconds for each request. The value configures Azure Core retry and transport deadlines. Nonpositive values disable SDK and transport deadlines.

30.0
use_exponential_backoff bool

Whether retries use exponential backoff.

True
initial_retry_delay_seconds float

The initial retry delay in seconds.

0.5
maximum_retry_delay_seconds float

The maximum retry delay in seconds.

120.0
retry_jitter_factor float

The jitter fraction applied to retry delays.

0.1
retry_unsafe_http_methods bool

Whether unsafe HTTP methods may be retried.

False
transport Optional[AsyncHttpTransport]

Optional Azure Core async HTTP transport closed by the client through its asynchronous lifecycle.

None
**kwargs Any

Optional Azure Core pipeline policy settings.

{}

Methods:

send_event async
send_event(input: SendEvent | Mapping[str, Any], event_hub_name: str, *, partition_key: Optional[str] = None, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> None

Send event

Send event.

Swagger operation ID: SendEvent.

Parameters:

Name Type Description Default
input SendEvent | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
event_hub_name str

Name of the Event Hub.

required
partition_key Optional[str]

Partition key.

None
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Name Type Description
None None

The operation completes without a response body.

Raises:

Type Description
ConnectorException

If the connector request fails.

send_events async
send_events(input: SendEventsInput, event_hub_name: str, partition_key: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> None

Send one or more events to the Event Hub partition

Send one or more events to the Event Hub partition.

Swagger operation ID: SendEvents.

Parameters:

Name Type Description Default
input SendEventsInput

The request body.

required
event_hub_name str

Name of the Event Hub.

required
partition_key str

Partition key.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Name Type Description
None None

The operation completes without a response body.

Raises:

Type Description
ConnectorException

If the connector request fails.

list_event_hubs
list_event_hubs(*, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[str]

Get all Event Hubs in a namespace

Get all Event Hubs in a namespace.

Returns a single-page Azure Core async collection.

Swagger operation ID: GetEventHubs.

Parameters:

Name Type Description Default
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncItemPaged[str]

AsyncItemPaged[str]: An Azure Core pager over connector results. Consume it with async for.

Raises:

Type Description
ConnectorException

If the connector request fails.

list_content_types
list_content_types(*, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[str]

Get all content types

Get all content types.

Returns a single-page Azure Core async collection.

Swagger operation ID: GetContentTypes.

Parameters:

Name Type Description Default
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncItemPaged[str]

AsyncItemPaged[str]: An Azure Core pager over connector results. Consume it with async for.

Raises:

Type Description
ConnectorException

If the connector request fails.

list_consumer_groups
list_consumer_groups(event_hub_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[str]

Get all the consumer groups for an event hub

Get all the consumer groups for an event hub.

Returns a single-page Azure Core async collection.

Swagger operation ID: GetConsumerGroups.

Parameters:

Name Type Description Default
event_hub_name str

The Event Hub name.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncItemPaged[str]

AsyncItemPaged[str]: An Azure Core pager over connector results. Consume it with async for.

Raises:

Type Description
ConnectorException

If the connector request fails.

list_partition_keys
list_partition_keys(event_hub_name: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[str]

Get all partition keys in an Event Hub

Get all partition keys in an Event Hub.

Returns a single-page Azure Core async collection.

Swagger operation ID: GetPartitionKeys.

Parameters:

Name Type Description Default
event_hub_name str

The Event Hub name.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncItemPaged[str]

AsyncItemPaged[str]: An Azure Core pager over connector results. Consume it with async for.

Raises:

Type Description
ConnectorException

If the connector request fails.

generate_event_schema async
generate_event_schema(content_type: str, *, content_schema: Optional[str] = None, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None

Generate event schema

Generate event schema V2.

Swagger operation ID: GenerateEventSchemaV2.

Parameters:

Name Type Description Default
content_type str

Content type.

required
content_schema Optional[str]

content schema of the event.

None
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
dict[str, Any] | None

dict[str, Any] | None: The connector operation result.

Raises:

Type Description
ConnectorException

If the connector request fails.