Connecting Your Services Together Flashcards
What is a message?
- Message contains raw data
- A message contains the data itself, not a reference
- The sending component expects the destination component to process the mesage in a certain way. The integrity of the overall system may depend on both the send and reciever doing a specifc job
What are events?
- An event is a lightweight notification that indicates that something happened.
- Event can be sent to multiple receivers (or none at all)
- Events a often intended to “fan out” or have a large number of subscribers for each publisher
- The publisher of the event has no expectation about the action of receiving component takes
- Some events are discrete units and unrealted to other events
- Some events are part of a related and ordered series
What is one of the main consideration in choosing between messages or events?
Does the sending ocmponent expect the communication to be processed in a particular way by the destination component?
What are the two Azure services that offer messaging services?
- Azure Storage Queues
- Azure Service Bus
What is an Azure Queue Storage?
is a service to store large number of messages that can securely accessed from anywhere in the world using a simple REST-based interfaces
They can contain millions of messages, limited only by the capacity of the storage account that owns it.
What is an Azure Service Bus
is a message broker system intended for enterprise applications.
Apps that use this service may have multiple communication protocols, data contracts, higher security requirements and can include both cloud and on premise services.
Service Bus is built on top of the dedicated messaging infrastructure designed for these scenarios.
What are Azure Service Bus Topics?
They’re like queues but can have multiple subscribers.
i.e. A topic may be “Listen” for a music app. There are two subscribers, ListenHistory and AddToFavorites. Each subscriber receives its own copy of the message to process.
What are the benefits of queues
Increase reliability
* message can stay in queue until the conmponent is available to process
Message delivery guarentees
* At-least-once delivery => delivered at least one. Keep in mind if you have more than one instance of your application, each instance may get the message
* At-Most-Once-Delivery => each message IS NOT guaranteed for delivery. Very small chance it may never. But there is NO chance it will be delivered twice (Referred to automatic duplicate detection)
* First-in-First-Out => If you need messages to be processed in order, select this option
Transactional Support
* Group messages in a transaction (i.e. Shopping Cart, Charge Account, Shipping)
What to choose between Service Bus Topics vs Service Bus Queues
Topics
* Multiple receievers
Queues
* Need an At-Most-Once delivery
* FIFO
* Transactional Support
* Receive message w/o polling
** Need to handle messages larger thatn 64 kb but less than 100 mb. (standard tier message is limited to 256 kb)
Queue size will not exceed 1 TB*
* Want to publish and consume batches of messages or multiple destinations
Another part of the Microsoft documentation says 80 GB for queue max size
Use Queue Storage if
- Need an audi trail of all messages passing through queue
- Expect queue to exceed 1 TB
- Want to track progress for processing a message inside a queue
Explain a good scenario for Event Grid
Someone upload a new song to Azure. A message is then sent to all subscribers subscribing to the Topic (i.e. Genre)
What is Event Grid?
is a fully managed event routing service (running on top of the Azure Service Fabric).
It provides a dynamically scalable, low-cost messaging system that allow publishers to notify subscribers about a status change
What are the 5 components of Event Grid?
- Events
- Event Sources
- Topics => the endpont where publishers send events
- Event Subscriptions => The endpoint or built-in mechanism to route events. Subscriptions are also used by handlers to filter incoming events intelligently
- Event Handlers
What is the max event/message size for Event Grid
64 kb
What are some of the schema fields for an Event Grid message?
- topic
- subject
- id
- eventType
- eventTime
- data {}
- dataVersion
- metadataVersion
What are System Topics?
They are built-in from Azure. You cannot see them in your subscription but you can subscribe to them.
What are custom topics?
Custom topics are application and third-party topics. When you create or are assigned access to a custom topic, you see that custom topic in your subscription.
What is an event subscription?
Event Subscriptions define which events on a topic an event handler wants to receive. A subscription can also filter events by their type or subject, so you can ensure an event handler only receives relevant even
What are some of the event sources for Event Grid?
- Azure Subscriptions and Resource Groups
- Container Registry
- Event Hubs
- Service Bus
- Storage Accounts
- Media Services
- Azure IoT Hub
What are some of the Event Handlers for Event Grid?
- Azure Functions
- Azure Logic Apps
- Webhooks
- Event Hubs
- Service Bus
- Storage Queues
- Microsoft Power Automate
Why you should use Event Grid
- Simplicity
- Advanced Filtering => Subscriptions have close control over the vents they receive from a topic
- Fan-out => you can subscribe to an unlimited number of endpoints to the same events and topics
- Reliability => retrieves event delivery for up to 24 hours for each subscription
- Pay-per-event => Pay for only the event that you transmit
What are Event Hubs?
Similar to Event Grid, however it is optimized for extremely high thoughput, a large number of publishers, security, and resilency
Same publisher/subscriber pattern
What are partitions in Event Hubs?
When an Event Hub receives communications, it divides them into partitions.
Subscribers can always use buffers to “catch up”. By default events stay in the buffer for 24 hours before expiring. The buffers are called partitions because the data is deviced amounst them. Each partition has a sperate set of subscribers.
Note, an event message can be set to a specific partition
What is Capture in Event Hubs?
Event Hub can send all your events immediately to Data Lake or Azure Blob Storage for inexpensive, permanent persistence
Authentication in Event Hubs
All publishers are authenticated and issued a token. This means Event Hubs can accept events from external devices and mobile apps, without worrying that fraudulent data from prankers could ruin our analysis.