Azure Service Bus Topic
Azure Service Bus Topic
This blog will brief on the distinction between Azure Service Bus
Topics and Azure Event Grid. First let us see a short introduction of
what these Azure services are, before getting deeper into their
distinctions. It is important to note the difference between services that
deliver an event and services that deliver a message. Service Bus
topics handles messages whereas Azure Event Grid handles events.
Event
An event is a lightweight notification of a state change. The publisher
of the event has no expectation of how the event is handled at the
other end. The consumer of the event decides what to do with the
received event. Events can be discrete units or part of a series.
Discrete events report state change and are actionable. To proceed
with the further step, the consumer only needs to know that something
happened. The event data has information on what happened but not
the data that triggered the event. Discrete events are ideal for
serverless solutions that need to scale.
Series events report a condition and are analyzable. The events are
time-ordered and interrelated. The consumer relies on the sequenced
series of events to examine what happened.
Message
A message is raw data produced by a service to be consumed or
stored. The message contains the data that triggered the message
pipeline. The publisher of the message has an expectation about how
the consumer handles the message. A contract exists between the two
sides. For example, the publisher sends a message with the raw data
and expects the consumer to create a file from that data and send a
response when the work is done.
1. FIFO
2. Batching/Sessions
3. Transactions
4. Dead lettering
5. Temporal control
7. Duplicate detection
implementation).
2. Dead Lettering
polling.
Lower cost
Serverless
Comparison of Services
Service Purpose Type When to use
Event
Event Reactive React to status
distribution
Grid programming changes
(Discrete)
Message/Event Delivery
Event Grid is a publish/subscribe(push-push) model where all the
events are pushed to the event handlers, whereas in the case of Azure
Service Bus Topic it keeps checking the topic subscription if there are
any messages available. This means that the Message Processor can
control when and how many messages it wants to process and thus
controls the load handled. In short Azure Event Grid uses push-model
whereas Azure Service Bus Topics uses a pull-model.
Protocols used by Azure Service Bus Topic to communicate –
Message/Event Processing
Since Azure Service Bus Topics uses pull mechanism the Message
Processor oversees getting new messages. It has full control on the
pace in which it processes the messages. If the ingestion throughput is
more, the messages will pile up until the size of the topic is met. With
Azure Event Grid the messages are pushed into the Event Handlers.
This means that the Event Handler needs to be capable to handle the
load and provide enough throttling to protect from crashing.
Throughput
Event Grid allows the processing of 10 million events per second, per
region. This is comparatively more than what Azure Service Bus can
handle unless it is distributed across multiple Service Bus namespaces
which has a limit of 100 per subscription.
Message/Event Sizes
Azure Service Bus supports the maximum message size of 256 KB for
basic/standard tier or 1 MB in case of the premium tier. Anything
beyond these quotas is rejected and an exception is received by the
calling code. In Event Grid topic, the size of an array can be up to 1
Mb. Each event in an array is limited to 64 KB.
Conclusion
In short, both these services are used for delivering events and
messages throughout a solution. Although these services have some
similarities, each service is designed for certain scenarios. Any of this
can be used based on necessity. When we are looking for processing
millions of events with high throughput, velocity and near-real-time
processing Azure Event Grid can opt-in comparison with Azure
Service Bus Topic whereas Azure Service Bus Topics can be used for
more fan-out transactional processing.
Also, explore how Serverless360 can help in lowering the Total Cost
of Ownership on supporting serverless applications in real-time.
Serverless360 has got capabilities that can address the gaps in dealing
with Service Bus topic subscriptions and Event Grid.
RELATED POSTS