Tutorial: Explore and classify events with different schemas

Building systems can send many kinds of events through one stream. A thermostat event contains temperature fields, an occupancy event contains people counts, and a badge-reader event contains access information. Schema-aware Eventstreams let you inspect these heterogeneous events and classify them without creating a separate pipeline for each event type.

Important

Schema-aware Eventstreams are in Preview.

In this tutorial, you learn how to:

  • Create a schema-aware Eventstream.
  • Send four building operations event types through a custom endpoint.
  • Inspect row details and nested JSON in Data preview.
  • Download selected events as JSON.
  • Classify events by using the deviceType field.
  • Verify the classified event types and their detected shapes.

Prerequisites

Create a schema-aware Eventstream

  1. In your Fabric workspace, select + New item.

  2. Search for and select Eventstream.

  3. Enter building-operations-es as the eventstream name.

  4. Select Enable schema-aware eventstream (Preview).

  5. Select Create.

    Screenshot of the New Eventstream dialog with Enable schema-aware eventstream selected.

Add a custom endpoint source

  1. Open the eventstream in Edit mode.

  2. Select Add source, and then select Custom endpoint.

  3. Enter building-operations-source as the source name, and then add the source.

  4. Select Publish.

  5. In Live mode, select the custom endpoint source.

  6. In the source details, copy these values:

    • Connection string-primary key
    • Event hub name

Important

The connection string contains a credential. Don't paste it into the Eventstream documentation, screenshots, or source control.

Send building operations events

Follow Generate building operations sample events to create and run the sample generator.

The generator sends 96 events by default: 24 events for each of these device types:

  • thermostat
  • occupancy_sensor
  • air_quality_monitor
  • access_badge_reader

Explore events in Data preview

  1. In the Eventstream, select the default stream.
  2. Select Data preview. You might need to select Refresh.
  3. Verify that the preview contains events with different values in the deviceType field.

View the complete payload

  1. Select an event row. You can also select multiple rows to view together.

  2. Select View row details.

    Screenshot of a selected event row and the View row details button in Data preview.

  3. In Row details, select Payload (if needed).

  4. Compare the fields in events from different device types.

    Screenshot of the Row details dialog with the Payload tab showing a nested JSON event.

Explore nested JSON

  1. Return to Data preview.

  2. On the payload column, select Expand objects.

    Screenshot of the Expand objects option on a nested payload column in Data preview.

  3. Verify that the payload fields appear as separate grid columns and that the breadcrumb shows level 1.

    Screenshot of expanded JSON fields displayed as grid columns with the level 1 payload breadcrumb.

  4. Select an earlier breadcrumb level to return to the previous view.

Download representative events

  1. Select one or more event rows.

  2. Select Download.

    Screenshot of multiple selected event rows and the Download button in Data preview.

  3. Open the downloaded JSON and verify that it contains only the selected events.

Classify the events

  1. Switch the Eventstream to Edit mode.

  2. Select the default stream.

  3. On the Data preview ribbon, select Classify unschematized events.

    The Classify unschematized events dialog opens.

    Screenshot of the Data preview grid with the Classify unschematized events button.

  4. Select the deviceType column.

  5. Review the four detected event types and their fields.

  6. Select Save.

    Screenshot of the Classify unschematized events dialog with deviceType selected, four detected event types, and the Save button.

  7. Select Publish.

Verify the classified event types

  1. In Live mode, select the default stream.

  2. In the Event type pane, expand Classified events.

  3. Verify that these event types appear:

    • thermostat
    • occupancy_sensor
    • air_quality_monitor
    • access_badge_reader

    Screenshot of Data preview with four classified event types listed in the Event type pane.

  4. Select each event type and compare the fields displayed in Data preview.

You now have one Eventstream that keeps the source events together while making each event type and its detected shape available for exploration and processing.

Clean up resources

If you don't plan to continue to the next schema-aware Eventstream tutorial, delete the building-operations-es Eventstream and remove the generator connection-string environment variable.