Event Grid - Subscriptions
Event Subscription
resource eventGridSubscription 'Microsoft.EventGrid/topics/eventSubscriptions@2023-12-15-preview' = {
parent: eventGridTopic
name: 'order-processor-subscription'
properties: {
destination: {
endpointType: 'WebHook'
properties: {
endpointUrl: 'https://my-api.azurecontainerapps.io/webhooks/orders'
}
}
filter: {
includedEventTypes: [
'Order.Created'
'Order.Updated'
]
}
retryPolicy: {
maxDeliveryAttempts: 30
eventTimeToLiveInMinutes: 1440
}
}
}Destination Types
Webhook
destination: {
endpointType: 'WebHook'
properties: {
endpointUrl: 'https://my-api.example.com/events'
}
}Azure Function
destination: {
endpointType: 'AzureFunction'
properties: {
resourceId: functionApp.id
}
}Service Bus Queue
destination: {
endpointType: 'ServiceBusQueue'
properties: {
resourceId: '${serviceBus.id}/queues/events'
}
}Event Hub
destination: {
endpointType: 'EventHub'
properties: {
resourceId: eventHub.id
}
}Filtering
Event Type Filter
filter: {
includedEventTypes: [
'Order.Created'
'Order.Shipped'
]
}Subject Filter
filter: {
subjectBeginsWith: '/orders/priority'
subjectEndsWith: '.json'
}Advanced Filter
filter: {
advancedFilters: [
{
operatorType: 'NumberGreaterThan'
key: 'data.amount'
value: 100
}
]
}