Event Hubs contain the following key elements:
- Event producers/publishers: The event can be published via AMQP or HTTPS.
- Capture: Azure Storage Blob item is used as a data storage repository for the events.
- Partitions: If a consumer wants to read a specific subset or partition of the event stream, partitions will provide the required options for the consumer.
- SAS tokens: Identity and authentication for the event publisher are provided by SAS tokens.
- Event consumers (receiver): Event consumers connect using AMQP 1.0. Any entity can read event data from an Event Hub.
- Consumer groups: Consumer groups provide a scale by providing separate views of the event stream. This provides each multiple consuming application with a separate view of the event stream, enabling those consumers to act independently.
- Throughput units: A throughput event provides scaling options. The customer can pre-purchase units of capacity. A single partition has a max scale of one throughput unit.
Azure Service Bus works on the competing consumer pattern. In the competing consumer pattern scenario, multiple consumers will process the messages as illustrated in the image shown as following.
These increases improve scalability and availability, on the same note, this pattern is useful for asynchronous message processing:
Event Hubs, on the other hand, work on the concept of partitions. Event Hub is composed of multiple partitions that will receive messages from publishers. As the volume of messages increase the number of partitions can be increased to handle the additional load.
Having partitions will increase the capacity to handle more messages and also have high throughput:
In summary, real-time streaming is all around us, be it a simple thermostat, your car telemetry, household electric meter data. Data is constantly streamed without anyone realizing it. For instance, when you are driving a car, the onboard computer is constantly doing the calculation on some telemetry data on the fly.
The final decision maker when it comes to the car is the driver that's in the driving seat. The same may not be true in other scenarios with modern day collision avoidance systems. If the onboard computer has enough data points that the car will collide with the car in front, it will decide to slow you down. That's where the real-time decision making comes into play.
The key objective of this book is to get you started on a very strong basis with event processing using Azure; as a reader, you can go on to do bigger and better things using this technology.
Before we dive further into this broad topic, let's see some of the core basics you need to know to get started.
An event-driven architecture can involve building a Publish and Subscribe, Event streaming model and a processing system:
- Publish/Subscribe: The underlying message infrastructure keeps track of subscriptions. Each subscriber will receive an event when it gets published.
- After the event is received, it cannot be replayed and new subscribers cannot see the event. In other words, you get only one opportunity to process the message. There is no way to go back to message to re-process or retry.
- Event streaming: In event streaming, clients are independent of the event producers, and they read from a common logging system.
- The client can read from any part of the system and they are responsible for advancing their posting in the stream.
- It also gives them the flexibility to join at any time and replay events as they want. One key feature set of event streaming is that, in a given partition, they are sequentially ordered and durable.
- If you look at message or event data they are simply data with a timestamp. This data need be processed by applying business logic or rule to derive or create an outcome. There are 3 well-known processing systems:
- Simple event processing
- Event stream processing
- Complex event processing