eventstream_client
sqllocks_spindle.fabric.eventstream_client
¶
Fabric Eventstream client — wraps azure-eventhub for custom endpoints.
Requires the azure-eventhub package::
pip install sqllocks-spindle[streaming]
Classes¶
EventstreamClient
¶
Bases: StreamWriter
Send event envelopes to a Fabric Eventstream custom endpoint.
Implements the :class:~sqllocks_spindle.streaming.stream_writer.StreamWriter
protocol so it can be used directly with :class:SpindleStreamer.
Supports both synchronous and asynchronous sending.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection_string
|
str
|
Event Hub-compatible connection string for the
Eventstream custom endpoint. Also accepts a secret reference
in the pattern |
required |
eventhub_name
|
str | None
|
Optional Event Hub / Eventstream name (can be embedded in the connection string instead). |
None
|
partition_key_column
|
str | None
|
Optional column name whose value is used as the partition key for ordered delivery per entity. |
None
|
max_batch_size
|
int
|
Maximum events per wire batch (default 500). |
500
|
max_retries
|
int
|
Number of retry attempts on transient failures. |
3
|
retry_delay_seconds
|
float
|
Base delay between retries (exponential backoff). |
1.0
|
Methods:¶
send_batch(events)
¶
Send a batch of event dicts through the Eventstream endpoint.
Large batches are automatically chunked to respect max_batch_size.
close()
¶
Close the synchronous producer client.
send_event(envelope)
¶
Send a single event envelope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
envelope
|
dict[str, Any]
|
A dict (typically from |
required |
send_event_async(envelope)
async
¶
Send a single event envelope asynchronously.
send_batch_async(envelopes)
async
¶
Send a batch of event envelopes asynchronously.
Creates or reuses an async EventHubProducerClient under the hood.
close_async()
async
¶
Close the async producer client.