[go: up one dir, main page]

Skip to content

clemensv/messaging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Asynchronous Messaging and Eventing Resources

Why would I care? | Definitions: Messaging or eventing infrastructure | Resources: Introductions and Patterns | Resources: Open Standards | Resources: Products & Cloud Services

Once you've read through this intro, you will find that this document contains a (growing) list of resources that cover whether and how to use asynchronous messaging/queueing and eventing infrastructures with your applications effectively and which you can use for self-study purposes.

I am the product architect of the messaging and eventing services in the Microsoft Azure cloud and have helped building these capabilities for over 15 years now, starting well before the name "Azure" even existed.

Our team owns multiple hyperscale broker platforms (Azure Service Bus, Event Hubs, Event Grid, and Relay) that are deployed in hundreds of large clusters in over 70 Azure regions all around the world and handle many (!) trillion (!) requests each day (!). We also invented, prototyped, and productized several other Azure capabilities (Azure IoT Hub, Azure Notification Hubs, Tenant Resource Provisioning) that are now owned by different teams at Microsoft.

In addition to the product work, I am deeply engaged in open interoperability standards and represent Microsoft on the OASIS AMQP Technical Committee (as co-chair), the OASIS MQTT Technical Committee, the CNCF Open Telemetry Working Group, the CNCF CloudEvents and CNCF xRegistry projects, and the CNCF Serverless Working Group. In the past, I've also been a member of the OPC Foundations Technical Advisory Council and the OPC UA Working Group where I've worked on the PubSub specification in particular. Relevant technical documents are also linked below.

"Why would I care?"

In addition to pointing to resources, allow me to also set some context with a few definitions (some of which may be surprising) of key concepts of messaging and eventing. I will keep these brief since the concepts are covered more broadly in many of the resources I point to.

Generally, if you are building software that requires more than one computer to do its job, you should know about asynchronous messaging concepts.

"Asynchronous" means here: Your application sends a message or event and then carries on doing something else. It does not sit around waiting for an outcome.

For many developers, that is the first giant mental hurdle, since we've all been raised on "imperative" programming models. You make a function call and cause some work to happen and only once that work has been reported as done (or failed) your own code continues with its work.

Yet, we all use asynchronous messaging every day in the physical world. If we want to send a gift to someone in a different city, we will go to the post office and entrust the postal service with the package. The postal service takes care of getting it to the destination and also tracks and reports whether the package has been delivered successfully. Once the package has been delivered, your friend might then call you and excitedly thank you for the gift you sent. If you ask for it you will get feedback, but maybe on a different channel and after however long the handling and delivery took and usually with a clear reference to the package you sent.

That is what asynchronous messaging infrastructure does, but for your apps.

  • Decoupling: A system handling work behind a messaging infrastructure can be running at capacity and yet not be overwhelmed and can even be down while the messaging infrastructure still accepts messages on its behalf.
  • Delivery: You can entrust over your messages and the messaging system will try its best not lose them. It will then attempt to deliver them to the right parties and will retry as often as necessary.
  • Buffering: A messaging infrastructure is generally great at accepting bursts of messages at once and organizing them for later retrieval. The retrieval can then occur at the pace that your application can handle. That is also called load-leveling.
  • Network-Bridging: Messaging infrastructures can often be attached to multiple networks, allowing information to pass between applications in those networks without there being IP-level connectivity between them.

Definitions: Messaging or eventing infrastructure

"Message broker", "queue", "service bus", "event router", "event stream engine", "event aggregator", are all names for asynchronous messaging and eventing infrastructure elements and the list is by no means exhaustive. I will give you a brief definitions for all the words in those names for orientation.

  • Producer - A producer (or sender or publisher) is a role in a software system that wants to share/distribute information and therefore produces messages and makes them available via a messaging infrastructure.
  • Consumer - A consumer (or receiver or subscriber) is a role in a software system that retrieves/gets messages from an messaging infrastructure and consumes them. Consuming often, but not always, means to act on the information.
  • Content - Content (or payload or body) is the information the producer wants the consumer(s) to receive and handle. Content may be any kind of data in any format.
  • Message - A message is an envelope that wraps the content for transfer. It contains metadata annotations that helps the messaging infrastructure and frameworks understand how to route and handle the information, just like the addressing information and "express" stickers on a postal package or letter envelope.
  • Event - An event is a variation of a message whose content reflects a fact. A fact is a historical statement of some past activity: "the milk carton dropped on the floor" is a fact that will forever be true when looking back at the morning of this day if it happened to you. The great thing about facts is that they can be easily distributed and cached and copied and transformed because the exact information they carry will forever be true and never again change. "Discrete" events are independent of other events (unlike those in a stream, see below) and are usually immediately actionable. (These philosophical considerations matter a lot for arriving at smart architectures).
  • Job - A job is a variation of a message whose content reflects an intent. The producer sends content with the intent of a consumer doing some work based on that content. "I just took this purchase order from a customer, please package and deliver these goods". Getting the job done might again involve multiple parties that handle parts if it, each being instructed through jobs.
  • Queue - A queue is a messaging infrastructure entity that assigns the exclusive ownership and temporary control over the lifecycle of a message to one of potentially many competing consumers. The consumer can decide to finally accept the message which removes it from the queue and thus prevents the work from being performed again or to make it again available for consumption if an error prevented the work from being completed such that a retry is possible. The message can also be rejected and sidelined if it cannot be processed even with a retry. Message queues may also provide ordering assurances which are defining for the "queue" data structure in computer science, but that is optional.
  • Router - A router ( or topic) is a messaging infrastructure entity that accepts messages from producers and dispatches them onwards to other messaging infrastructure entities or to consumers, often considering rules that inspect the message metadata annotations. Routers may often be configured dynamically and at runtime to deliver messages to interested parties, which are then called subscribers.
  • Stream - An event stream (or event series) is a sequence of related events, which typically stem from the same producer or at least the same producer context (i.e. multiple producers create events about the same thing). An event stream engine may multiplex delivery of many concurrent event streams (occasionally also called topic) and may split those up across several physical logs (partitions) while keeping any one event stream together on a partition to ensure preserving order.
  • Checkpoint - Event streams are usually processed by taking several events at a time. Since events are not jobs and therefore do not require exclusive handling, event stream engines therefore shift the burden of keeping track of what events have and have not been consumed to the consumer themselves. Consumer will periodically note a checkpoint relative to the stream and/or partition and resume from that noted checkpoint when needed. Some event stream brokers have internal facilities that help with noting those checkpoints.
  • Broker - Broker (or service bus) is the term for a server or infrastructure that brokers messages and does so via queues or routers or streams. Brokers generally only act on metadata of messages and do not consider the content of the message.
  • Aggregator - An aggregator or stream processor or stream analytics engine is a compute service that takes one more more event streams as input and yields one or more event streams or derived discrete events as output. The output(s) might be a filtered view of the input stream or consist of computed aggregates of input eventsor it might be a join of multiple streams or streams with reference data. Contrary to brokers, aggregators will consider the content of events.
  • Schema - A formal description of the structure of the content of a message or event. Schemas are used to validate the content of messages and events and to help with the interpretation of the content. Schemas are often versioned and evolve over time. Schemas are often shared between producers and consumers to ensure that the content is understood correctly.

Presentation Folder

You can find all my published presentations as PowerPoint files and PDFs in this folder. Content is generally CC-BY 4.0.

Introductions and Patterns

Open Standards

This section lists several open standards efforts that are important to the messaging space. The focus of this section is on open and product/project-neutral data formats and protocol standards, not on project-proprietary wire formats even if the projects are open source.

CNCF CloudEvents

CloudEvents is a common information model for events. It defines what an event is and what a set of common attributes are that make the event useful in many contexts. CloudEvents then defines formats (JSON, Avro, AMQP, Protbuf, XML) in which a CloudEvent can be expressed and protocol bindings for how CloudEvents can be transported (HTTP, AMQP, MQTT, Kafka).

CloudEvents

CNCF xRegistry

xRegistry is a project spawned from the CloudEvents project that aims to provide a common API and document format for schema and message catalogs and discovery services. It is a companion to CloudEvents and aims to provide a common way to find and use schemas and messages in a CloudEvents context, but also for general messaging infrastructures. xRegistry is extensible to support other metadata models.

xRegistry

OASIS AMQP

AMQP ("Advanced Message Queue Protocol") is the global standard enterprise messaging protocol. Initiated by JPMorgan, it's the standard protocol in many areas of the financial industry, trade, and industrial applications. It has been developed in OASIS and standardized by ISO as 19464:2014.

AMQP is implemented by a most major queue-oriented message brokers.

OASIS MQTT

MQTT (formerly "MQ Telemetry Transport") is a lightweight pubsub protocol that was initially developed by IBM as a companion protocol to their MQ product. IBM then submitted it for standardization to OASIS, where the input specification was turned into version 3.1.1. and the TC then developed version 5.0 from there, with significant input from Microsoft.

Apache Avro

Avro is a data serialization system that provides rich data structures and a compact, fast, binary data format. At Microsoft, we like Avro's Schema format even more than we like its binary encoding. Unfortunately and fortunately, the Avro project is a bit of a "sleeping beauty" and has not seen much evolution in the last few years. We think it could need a bit of a jolt and to that effect, we have a few pending proposals that we hope to get into the project soon.

  • Official Avro Specification
  • Formal Avro Schema spec (proposed)
    This is a proposed formal specification of the Avro Schema format in RFC-style that is currently only informally described in the Avro documentation. The proposal aims to make the Avro Schema format more predictable and easier to implement and to use in code generators and other tools.
  • Avrotize Schema spec (proposed)
    This is a proposed formal specification of the Avrotize Schema format that is derived from the Avro Schema format and adds a few additional features that make it more suitable for use in code generators and other tools. The Avrotize Schema format is a superset of the Avro Schema format.
  • Avro Schema JSON Schema (proposed)
    This is a proposed JSON Schema for the Avro Schema format that can be used to validate Avro Schema documents.
  • "Plain JSON" encoding for Apache Avro
    The Apache Avro project defines a JSON Encoding, which is optimized for encoding data in JSON, but primarily aimed at exchanging data between implementations of the Apache Avro specification. The choices made for this encoding severely limit the interoperability with other JSON serialization frameworks. This document defines an alternate, additional mode for Avro JSON Encoders, preliminarily named "Plain JSON", that specifically addresses identified interoperability blockers.

Related Projects

  • Real-Time Sources
    Learning how to build event streaming solutions with Microsoft Azure Event Hubs, Microsoft Fabric Event Streams, and any Apache Kafka compatible server and service is more interesting when you have real time data sources to work with. This repo contains command line tools, written in Python, that can be used to retrieve real-time streaming data and related reference data from various APIs, and then routing the data to Apache Kafka compatible endpoints. For each tool, there is a corresponding, pre-built (Docker-) container image that you can pull and use instantly from this repo's container registry.
  • Forza Telemetry Bridge
    ForzaBridge is a console application designed to capture and forward Forza Motorsport telemetry data to Microsoft Azure Event Hubs or Microsoft Fabric Event Streams. It utilizes UDP to listen for telemetry data sent from Forza Motorsport games and forwards this data after processing and formatting into cloud event streams. The bridge is immediately derived from a project that implements a production telemetry pipeline for race cars competing in the WEC and IMSA endurance championships.

Books

An incomplete list of books about product-/project-neutral messaging and eventing principles and patterns. I am an impatient book reader and prefer going straight to authoritative documents, therefore I am happy to take PRs for this section from readers who've been helped by particular books.

Products & Cloud Services

Microsoft Fabric

Microsoft Fabric is Microsoft's data platform. The "Real-Time Intelligence" feature set combines event streaming, event stores and event processing into an easy-to-use SaaS offering aimed at data analysts and data scientists. The "Event Streams" feature set is built on top of the popular and proven Microsoft Azure Event Hubs and Azure Stream Analytics services and provides a fully managed, scalable, and secure event streaming platform. The Fabric Eventhouse is the SaaS-incarnation of the Azure Data Explorer service, which is the evolution of the Kusto database that is used to power many of Microsoft's own telemetry systems. Fabric Data Activator allows acting on complex conditions in real-time, putting processes or people into the loop of processes when needed.

Microsoft Azure

This is a list of the Azure Messaging services.

AWS

AWS has a fleet of messaging services which reflects very similar architectural considerations as the Azure services.

Apache

The Apache Software Foundation hosts several popular open source projects that produce message and event broker infrastructures.

  • ActiveMQ - transactional queue and pubsub broker family (ActiveMQ "Classic" and Artemis)
  • Qpid - transactional queue and pubsub broker family, also including an AMQP router
  • Pulsar - event stream engine and queue broker
  • Kafka - event stream engine
  • Camel - integration framework with hundreds of components and several patterns

CNCF

The Cloud Native Computing Foundation also hosts a few messaging and eventing centric projects.

  • NATS - fast, simple pubsub message broker
  • Pravega - stream-oriented replicated storage
  • Strimzi - Kubernetes operator for Apache Kafka, curiously in CNCF and not in the ASF and the Apache Kafka project, which says something about the latter.

Eclipse

The Eclipse Foundation has a strong IoT focus and hosts various MQTT-related projects. It is also hosting the Jakarta Messaging project that carries forward the popular JMS standard.

  • Mosquitto - reference MQTT broker implementation
  • Paho - MQTT librarry collection for several programming languages
  • Jakarta Messaging (JMS) - the one-and-sadly-only universal Java API for message brokers, with an sadly-ultra-opinionated topology concept. Needs a thorough overhaul, but is here and very useful.

About

Resource collection for messaging and eventing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •