azure service bus - part of our azure consulting service in south florida

Cloud-scale Messaging with Azure Service Bus and Event Hubs

Sophisticated message-handling plays a central role in cloud and hybrid workflows in 2018. For Azure users, two message-handling services stand out. The first, Service Bus, is built around queues and is one of Azure’s most mature and robust services. The second, Event Hubs, is built around data streams and helps Service Bus handle event-related messages at any scale. Here we take a deep dive into these two exceptional Azure services before touching on two closely related offerings (Relay and Hybrid Connections) that round out Azure’s industry-leading messaging platform.

Service Bus

After nearly a decade of improvements, Azure Service Bus has earned a reputation as the most stable and robust queue-based messaging service in the cloud. Service Bus supports a wide variety of processes such as routing, scheduled delivery, logging, load balancing and load leveling. Although Service Bus works well for handling free-form messages, it’s also widely used for handling highly structured, machine-readable messages that support transactions and processes in finance, logistics, healthcare, government, education and dozens of other industries.

Queues

At a foundational level, Service Bus is built around message queues. You can think of a message queue as a stack of messages. Rather than sending a message directly to its destination, a system can send it into a queue for more sophisticated handling and batch-processing. After the queue acknowledges receipt of the message, the receiver is free to retrieve the message from the queue. In this sense, the message queue serves as a convenient buffer between the message sender and receiver. By decoupling sender and receiver through a queue, the messaging service is free to perform not only asynchronous delivery, but any number of other sophisticated message-handling maneuvers.

Topics and subscriptions

Topics and subscriptions come together to create a more advanced message-handling process that offers Service Bus users a high degree of control over message categorization and filtering. Message senders are attached to topics. Message receivers are attached to subscriptions within each topic. First, all messages injected into the queue are categorized into topics that behave just like queues themselves. Next, message receivers can subscribe to various types of messages within a given topic, such as service updates, orders, quotes, and so on.

One of the key virtues of topics and subscriptions is that you no longer need to build an expensive, complex and error-prone “universal dispatcher” that decides what to do with every message in the queue. Topics and subscriptions give you all the functionality of an expensive, custom dispatcher with the invaluable bonus of high reliability at scale.

Service Bus features

Azure maintains that with Service Bus they currently have “the most sophisticated messaging platform in the cloud.” After nearly a decade of updates, the Service Bus feature set certainly has the breadth and depth to back up that claim. Let’s look at few of the most salient features:

Scheduled messages

This widely used Service Bus feature works with both queues and topics. You simply schedule a message for injection into a queue or topic at a specific time. Until that time comes, you can easily cancel the scheduled message.

Poison message handling

This feature finds and removes unreadable, error-ridden messages that are jamming the queue and preventing other messages from being sent.

RELATED  5 Aspects of Implementing a HIPAA Compliant Cloud You Need to Know

Message deferral

Designed to aid in workflow processing, the message deferral feature allows applications to defer specific messages from being processed “until prescribed prior work” is performed.

Message sessions

Service Bus message sessions are ideal for users that want or need to guarantee a first-in, first-out (FIFO) queue.

Other features

Service Bus has a wide variety of rich features over and above the list above. Here are a few of the most widely used:

  • Batching
  • Ordering
  • Auto-delete on idle
  • OnMessage
  • Duplicate detection
  • Filters
  • Actions
  • Transactions

Pricing

Service Bus now enjoys the standard three-tiered pricing structure found in most newer Azure services. Originally focused primarily on startups and smaller businesses, the mature Service Bus platform has rolled out a premium package for enterprise messaging over the last few years. In general, the premium option offers improved send/receive performance with greater overall consistency and predictability. Specifically, the premium offering comes with dedicated capacity, larger maximum message size, and fixed pricing. Moreover, there is no charge for messaging operations.

Event Hubs

Event Hubs, unlike Service Bus, specializes in the rapid accumulation and dissemination of event-related messages from a wide variety of event producers. Although telemetry data flowing in from IoT-enabled devices and machines is a major data source for Event Hubs, the highest volume of data comes from application logging (e.g. status updates) and application performance telemetry.

A stream, not a queue

Event Hubs works with a stream of data, rather than a queue. The service also works within a limited length of recording volume whose size you can specify based on your needs. Accordingly, Event Hubs is constantly adding new data and removing old data from the stream under a FIFO approach.

Partitions

Each event hub is divided into entirely separate channels, known as partitions. Each partition presides over its own portion of the event hub’s overall data stream. Event producers do not need to categorize the event data they send to an event hub. They need only send it. By default, every event hub will distribute incoming data evenly between its partitions for “the best availability and performance.” Although overriding the defaults and sending event data directly to a single partition may serve your purposes in some cases, it’s important to remember that this approach may involve considerable availability and performance trade-offs.

Event consumers

Event consumers (aka event receivers), numbering one for each partition, read and consume event data from your event hub’s partitions. Each set of event consumers performs the data reading process by way of a consumer group that offers a unique “view of the event stream” flowing through the event hub. By way of consumer groups, applications accessing an event hub can have their “own separate view” while reading data “at their own pace” and according to their own settings.

Connection to the IoT

The Event Hubs service is a particularly strong fit for enterprises leveraging the Internet of Things (IoT). If you think of each unit of telemetry data (coming from an IoT-enabled device) as a machine-generated message, then you can see how Event Hubs behaves as a highly efficient messaging platform. Capable of taking in “millions of events per second,” Event Hubs is built to scale as the IoT grows.

RELATED  7 Habits of The Most Successful E-commerce Websites Owners

Helping Service Bus scale

An influx of extremely high volumes of event-related messages can easily overwhelm even the most efficient queue-based messaging service, such as Service Bus. Therefore, to prevent message throttling, it’s often necessary to have an additional service working as an intermediary between the event publishers and the queue itself. Event Hubs serves exceptionally well in that capacity.

Pricing

Like Service Bus, Event Hubs has a three-tiered pricing structure. While the Basic and Standard offerings are both pay-as-you-go, the Dedicated offering is available at a flat monthly rate.

Related Azure messaging services

No overview of Azure messaging is complete without mentioning Azure Relay and Hybrid Connections. Working in conjunction with Service Bus, these two services help you access your on-premises data from the cloud.

Relay

Acting within hybrid cloud environments, Azure Relay serves as a messaging bridge between your on-premises and cloud resources, workflows and data streams. For example, whenever a cloud-hosted app in your Azure hybrid environment needs some data from one of your on-premises databases, you can have it automatically message Relay with a request for the data it needs. Relay will pass that request on to the corresponding on-premises database, then relay the response (generally with the requested data) back to your cloud app.

One of the primary reasons that Azure users with hybrid cloud environments choose to use Relay is that it allows on-premises services to use outbound ports and connections. Because only inbound connections generally require opening new firewalls, creating a new firewall is generally not a requirement for Relay users.

Hybrid Connections

Depending on your perspective, you may view Hybrid Connections either as a feature of Azure Relay or as a separate service. Either way, the essential idea behind Hybrid Connections is that it connects your cloud resources to your on-premises resources through a non-propriety, open protocol “based on HTTP and WebSockets.” Many Azure users strongly prefer this new option to Relay’s former, proprietary approach.

Leveraging Azure’s complete cloud messaging platform

Cloud and hybrid environments in 2018 often rely on sophisticated message-handling in order to achieve the most advanced and efficient workflows. As argued above, Azure Service Bus and Event Hubs serve that need remarkably well. As one of Azure’s most mature and robust offerings, Service Bus provides advanced queues (along with topics and subscriptions) to give Azure users granular control over asynchronous message-handling. Features such as scheduled messages, poison message-handling, message deferral and message sessions make this mature service all the more robust and compelling.

Event Hubs, built around data streams rather than queues, is a perfect complement to Service Bus. Often serving as a high-volume buffer between event producers and Service Bus queues, Event Hubs helps Azure users scale their workflows as their businesses embrace the IoT.

Finally, Azure Relay and Hybrid Connections round out Azure’s industry-leading messaging platform. While Relay serves as a highly efficient means for pulling on-premises data into cloud-hosted applications, Hybrid Connections offers a new, non-proprietary protocol for performing this feat.

For more information on Service Bus, Event Hubs and other Azure consulting services transforming the cloud in 2018, contact us.

About Jeff Collins

Experience and Expertise make the difference when searching for top cloud providers. Appliedi has provided managed cloud services since 1999.