Service Bus Topics
Updated: March 13, 2014
Topics extend the messaging features provided by queues with the addition of publish-subscribe capabilities.
A topic entity consists of a sequential message store like a queue, but it supports up to 2000 (this number is subject to vary in the future) concurrent and durable subscriptions, which relay message copies to a poll of worker processes. As depicted in the following figure, each subscription can define one or multiple rule entities.
Each rule specifies a filter expression that is used to filter messages that pass through the subscription and a filter action that can modify message properties. In particular, the SqlFilter class allows a SQL92-like condition to be defined on message properties, as in the following examples:
OrderTotal > 5000 OR ClientPriority > 2
ShipDestinationCountry = ‘USA’ AND ShipDestinationState = ‘WA’
Conversely, the SqlRuleAction class can be used to modify, add or remove properties to a BrokeredMessage object using syntax similar to that used by the SET clause of an UPDATE SQL-command, as in the following examples.
SET AuditRequired = 1
SET Priority = 'High', Severity = 1
|Each matching rule generates a separate copy of the published message, so any subscription can potentially generate more copies of the same message, one for each matching rule.|
Topics, like queues, support a competing consumers scenario: in this context, a subscription can have a single consumer that receives all messages or a set of competing consumers that fetch messages on a first-come-first-served basis. Topics are a useful messaging solution for broadcasting messages to many consumers.
Other ResourcesUnderstanding Windows Azure AppFabric Queues (and Topics) video on the AppFabric Team Blog.
An Introduction to Service Bus Topics article on the AppFabric Team Blog.
Windows Azure AppFabric Service Bus Queues and Topics on Neil Mackenzie's Blog.
Windows Azure AppFabric Learning Series available on CodePlex