Explore Azure Event Grid Flashcards

(30 cards)

1
Q

What is Azure Event grid (EG)?

A

Highly scalable, fully managed pub sub message distribution service that offers flexible message consumption patterns using HTTP and MQTT protocols

Supports push and pull delivert

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the publisher in relation to event grid?

A
  • App that sends events to EG
  • Can be same app as where the event originated, the event source
  • Azure services, your own apps or organisations that host services outside azure can all publish events thrrough EG
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a partner in EG?

A
  • Kind of publisher that sends events from its system to make them available to azure customers
  • can also receive events
  • enabled through partner events feature
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the definition of an event?

A
  • Smallest amount of info that describes something that happened in a system
  • Has common info like source, time and unique ID
  • Has specific info that only related to that specific event type
  • Conforms to CloudEvents 1.0 spec using HTTP protocol binding with JSON format
  • Max size is 1MB for both events and the arrays that contain events, events over 64KB are charged in 64KB increments
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an event source in EG?

A
  • Each source is related to one or more event types
  • e.g. Azure storage is source for blob created events, IoT hub is source for device created events, your app is source for custom events that you define
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are topics in EG?

A
  • Hold events that have been published to event grid
  • used for a collection of related events
  • subs decide which topic to sub to
  • 3 types = system, custom and partner
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are system topics?

A
  • Built in
  • dont see them as publisher owns the topics but you can sub to them as long as you have access to the resource that you want to receive events from
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are custom topics?

A
  • application and third party topics
  • when you create or are assigned access to a custom topic you can see it in your subscription
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are partner topics?

A

Kind of topic used to sub to events published by a partner

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are event subscriptions in EG?

A
  • tells EG what events on a topic youre interested in receiving
  • During creation you provide an endpoint for handling the event
  • can filter the events that are sent to the endpoint by type or subject pattern
  • can create expirations for subscriptions
  • must have adequate perms on the EG topic to sub
  • can set up to 10 custom headers on setup
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are event handlers?

A
  • Where the event is sent
  • can use AZ services or own webhook
  • For HTTP webhooks the event is retried until a 200 response retruned
  • for storage queues the events are retried until the queue successfully processing the message push
  • if using push delivery the handler is the AZ service and a managed ID is used to auth EG. managed ID should have correct RBAC
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What schemas are support in EG? How does the structure look?

A
  • EG schemas and cloud event schema
  • events consist of 4 required string properties
  • data object then has the properties that are specific to the publisher (for system topics these are specific to the resource provider)
  • sources sends events to EG in an array which can have several objs
  • EG sends events to subs in an array that has a single event
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What properties do all events have?

A

Topic = string, not required, full resource path to the event subject
Subject = string, required, publisher-defined path to the event subject
EventType = string, required
eventTime = string, required
Id = string, required
Data = object, not required, event data specific to the resource provider or event publisher in custom topics
dataVersion = string, not required, publisher defines the schema version
metadataVersion = string, not required

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are event subjects?

A
  • Should be used to make it easy for subs to know whether they’re interested in the event
  • subs use subject to filter and route events
  • consider providing the path for where the event happened so subs can filter by segements of that path
    e.g. /A/B/C is the path then subs can filter by /A to get broad set of events or /A/B/C to get specific
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is CloudEvents

A
  • Open specification for describing event data
  • simplifies interoperability by providing a common event schema for publishing and consuming cloud based events
  • allows for uniform tooling and universal ways of deserializing the outer event schema
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How are cloud events and event grid schema similar?

A
  • Headers are identical to EventGridSchema except for content-type
  • for cloudEvents that value is = “content-type”: “application/cloudevents+json; charset=utf-8”
  • for EG that value is “content-type”: “application/json; charset=utf-8”
  • can use EG for both input and output of events in CloudEvents schema
  • can use cloudevents for system events like BlobStorage, IoT hub and custom event
17
Q

How does EG deliver events?

A
  • tries to delivery each event at least once for each matching sub
  • if sub endpoint doesn’t acknowledge receipt or if there’s a failure EG retries delivery based on a fixed retry schedule and retry policy
  • by default EG delivers one event at a time to the sub and the payload is an array with a single event
  • EG does NOT guarantee order for event delivery so sub may receive them out of order
18
Q

How will EG handle config errors returned by a sub endpoint?

A
  • if config related that cant be fixed with retries it will either perform dead-lettering on the event or drop the event if dead-lettering isnt configured
  • Azure resource 400 and 413 errors do not trigger retries
  • Neither do webhook 400, 413 or 401
19
Q

How will EG handle general errors returned by sub endpoint?

A
  • can be fixed with retries so waits 30 seconds for a response then retries
  • if endpoint responds within 3 mins EG attempts to remove the event from the retry queue on a best effort basis but duplicates might still be recieved
  • can configure max number of retries and event TTL
  • az eventgrid event-subscription create -g gridRGName –topic-name X –name subscriptionName –endpoint Y –max-delivery-attempts Z
20
Q

How can EG improve HTTP performance in high-throughput scenarios?

A
  • batch events for delivery, turned off by default
  • max events per batch is a number that will not be exceeded but fewer evenbts might be deliveredif no other events are available at time of publish, EG doesnt delay events to create a batch
  • preffered batch size in KB is similar to max events, the size might be smaller if more events arent available at time of publish, possible batch is larger than preffered size IF a single event is larger
21
Q

How does EG protect unhealthy endpoints from being overwhelemed?

A

EG delays the delivery and retry of events to that endpoint

22
Q

What is dead-lettering in EG?

A
  • Process of sending events that cannot be delivered to a storage account
  • sent here if either the event isnt delivered in the TTL period or the number of retries exceeds a limit
  • 5 min delay between last attempt to deliver an event and delivery to dead-letter location, intended to reduce number of blob storage operations
23
Q

What RBAC roles does EG provide?

A
  • EG Sub Reader
  • EG sub contributor = lets you manage and create EG subs
  • EG contributor = lets you manage and create EG resources
  • EG data sender

EG sub reader and EG sub contributor are needed to give users perms to sub to topics in your event domain but dont allow you to create topics

24
Q

How do I give permissions to event handlers that are azure resources?

A
  • need write access to that resource
  • must have EventSubscriptions/Write perm on the event source
  • for system topics need perms to write a new event sub at the scope of the resource publishing the event “/subscriptions/{subId}/resourceGroups/{RGName}/providers/{resource-provider}/{resource-type}/{resource-name}”
  • for custom topics need perms to write a new event sub at the scope of the event grid topic
    /subscriptions/{subscriptionId}/resourceGroups/{rgName}/providers/Microsoft.EventGrid/topics/{topic-name}
25
How does EG handle auto validation of some services?
- if you use one of the following azure services EG auto handles validation to ensure that you own the webhook endpoint where the events are being sent logic apps with event grid connector automation via webhook functions with eventgrid trigger
26
How do we validate other services with EG handshake?
- if using endpoints such as HTTP trigger based functions your code needs to participate in a validation handshake with EG - sychronous handshake = at time of EG sub creation EG sends a sub validaiton event to your endpoint, schema is similar to any other EG event. Data portion includes validationCode property, app verifies that the request is for an expected event sub and returns validation code the response - asynchronous handshake = if you use a third party service you cant programmatically respond with the validaiton code
27
How do we manually validate with EG?
- EG sends a validationUrL property in the data portion of the sub validation event - find that URL and do a GET request to it using a REST client or web browser - URL valid for 5 min, during which the state of the event sub is "AwaitingManualAction" - state set to fail if dont validate in 5 min
28
How can we filter events when sending to the event sub endpoint?
- can decide to only send certain types of events to the endpoint using filtering - e.g. you get notified of updates to your resources but not notified for other operations like deletions "filter": { "includedEventTypes": [ "Microsoft.Resources.ResourceWriteFailure", "Microsoft.Resources.ResourceWriteSuccess" ] } - You can also filter on event subject e.g. "subjectBeginsWith": "XYZ/ABC" or "subjectEndsWith": ".jpg"
29
What advanced filtering options are available in EG?
- can filter by values in the data fields "filter": { "advancedFilters" : [ { "operatorType": "NumberGreaterThan", "key": "data.key1", "value": "5" } ] }
30
Command to create event grid topic?
az eventgrid topic create --name X --location Y --resource-group Z