Handling Event Grid events

Media Services logo v3


Warning

Azure Media Services will be retired June 30th, 2024. For more information, see the AMS Retirement Guide.

Media Services events allow applications to react to different events (for example, the job state change event) using modern serverless architectures. It does so without the need for complicated code or expensive and inefficient polling services. Instead, events are pushed through Azure Event Grid to event handlers such as Azure Functions, Azure Logic Apps, or even to your own Webhook, and you only pay for what you use. For information about pricing, see Event Grid pricing.

Availability for Media Services events is tied to Event Grid availability and will become available in other regions as Event Grid does.

Media Services events and schemas

Event grid uses event subscriptions to route event messages to subscribers. Media Services events contain all the information you need to respond to changes in your data. You can identify a Media Services event because the eventType property starts with "Microsoft.Media.".

For more information, see Media Services event schemas.

Samples and How-to

The Media Services samples repository for .NET demonstrates how to use the latest Event Grid and Event Hubs client libraries to receive events in your own custom applications.

Use Event Grid to monitor Media Services events in the Azure portal.

Practices for consuming events

Applications that handle Media Services events should follow a few recommended practices:

  • As multiple subscriptions can be configured to route events to the same event handler, it is important not to assume events are from a particular source, but to check the topic of the message to ensure that it comes from the storage account you are expecting.
  • Similarly, check that the eventType is one you are prepared to process, and do not assume that all events you receive will be the types you expect.
  • Ignore fields you don’t understand. This practice will help keep you resilient to new features that might be added in the future.
  • Use the "subject" prefix and suffix matches to limit events to a particular event.

Note

Events are subject to the Event Grid Service Level Agreement (SLA). If you want to get event notifications using APIs, see examples on how to consume events, with .NET SDK or Java SDK.