FabricBusinessEventsClient Class
Client for publishing Fabric Business Events.
Extends EventGridPublisherClient with a convenience PublishEvent() method.
A User Data Function with a parameter of this type must be decorated with connection (see the example under Remarks).
Initialize the client.
Constructor
FabricBusinessEventsClient(*, alias_name=None, endpoints, **kwargs)
Parameters
| Name | Description |
|---|---|
|
alias_name
Required
|
The alias name for this connection |
|
endpoints
Required
|
FabricItem-style endpoints dict containing beendpoint with ConnectionString and AccessToken |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
udf_rid
|
UDF resource ID for building Cloud Event source |
|
schemaset_uri
|
Schemaset URI base for building dataschema |
|
<alias>_schemaset_rid
|
Schema set resource ID for this alias |
|
allowedEvents
|
List of allowed event types (for future validation) |
|
alias_name
|
Default value: None
|
|
endpoints
Required
|
|
Remarks
To use this class and have Fabric make the proper connections to Business Events, you must:
- Add a data connection in the Connections tab of your User Data Functions on the portal.
- Add a parameter to your User Data Function with the type 'FabricBusinessEventsClient'.
- Add the decorator connection to your User Data Function that references the parameter and the alias of the data connection you made.
Methods
| PublishEvent |
Publishes a CloudEvent with the provided event data. This is a convenience method that creates a CloudEvent and sends it in one call. |
PublishEvent
Publishes a CloudEvent with the provided event data.
This is a convenience method that creates a CloudEvent and sends it in one call.
PublishEvent(type: str, event_data: Dict[str, Any] | List[Dict[str, Any]], data_version: str = 'v1') -> None
Parameters
| Name | Description |
|---|---|
|
type
Required
|
The type of the event (REQUIRED) |
|
event_data
Required
|
A dictionary or list of dictionaries containing the event data to be sent (REQUIRED) |
|
data_version
|
Version ID for building dataschema (defaults to "v1") Default value: v1
|
Examples
# Single event
event_data = {
"orderId": "12345",
"status": "shipped",
"orderDeliverAddress": "123 Main St"
}
# or multiple events
event_data = [
{"orderId": "12345", "status": "shipped"},
{"orderId": "67890", "status": "shipped"}
]
client.PublishEvent(
type="order.shipped",
event_data=event_data,
data_version="v1"
)