Skip to content

Commit 382027b

Browse files
authored
Merge pull request #24611 from sethmanheim/cv10
Adding topic filters article
2 parents 5b893f5 + 1497f54 commit 382027b

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

articles/service-bus-messaging/TOC.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
### [Message sequencing and timestamps](message-sequencing.md)
5252
### [Message browsing](message-browsing.md)
5353
### [Message transfers, locks, and settlement](message-transfers-locks-settlement.md)
54-
### [Message expiration (Time to Live)](message-expiration.md)
54+
### [Message expiration (Time to Live)](message-expiration.md)
55+
### [Topic filters and actions](topic-filters.md)
5556
### AMQP
5657
#### [AMQP overview](service-bus-amqp-overview.md)
5758
#### [.NET](service-bus-amqp-dotnet.md)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Azure Service Bus topic filters | Microsoft Docs
3+
description: Filter Azure Service Bus topics
4+
services: service-bus-messaging
5+
documentationcenter: ''
6+
author: clemensv
7+
manager: timlt
8+
editor: ''
9+
10+
ms.service: service-bus-messaging
11+
ms.workload: na
12+
ms.tgt_pltfrm: na
13+
ms.devlang: na
14+
ms.topic: article
15+
ms.date: 10/02/2017
16+
ms.author: sethm
17+
18+
---
19+
20+
# Topic filters and actions
21+
22+
Subscribers can define which messages they want to receive from a topic. These messages are specified in the form of one or multiple named subscription rules. Each rule consists of a condition that selects particular messages and an action that annotates the selected message. For each matching rule condition, the subscription produces a copy of the message, which may be differently annotated for each matching rule.
23+
24+
Each newly created topic subscription has an initial default subscription rule. If you don't explicitly specify a filter condition for the rule, the applied filter is the **true** filter that enables all messages to be selected into the subscription. The default rule has no associated annotation action.
25+
26+
Service Bus supports three filter conditions:
27+
28+
- *Boolean filters* - The **TrueFilter** and **FalseFilter** either cause all arriving messages (**true**) or none of the arriving messages (**false**) to be selected for the subscription.
29+
30+
- *SQL Filters* - A **SqlFilter** holds a SQL-like conditional expression that is evaluated in the broker against the arriving messages' user-defined properties and system properties. All system properties must be prefixed with `sys.` in the conditional expression. The [SQL-language subset for filter conditions](service-bus-messaging-sql-filter.md) tests for the existence of properties (EXISTS), as well as for null-values (IS NULL), logical NOT/AND/OR, relational operators, simple numeric arithmetic, and simple text pattern matching with LIKE.
31+
32+
- *Correlation Filters* - A **CorrelationFilter** holds a set of conditions that are matched against one or more of an arriving message's user and system properties. A common use is to match against the **CorrelationId** property, but the application can also choose to match against **ContentType**, **Label**, **MessageId**, **ReplyTo**, **ReplyToSessionId**, **SessionId**, **To**, and any user-defined properties. A match exists when an arriving message's value for a property is equal to the value specified in the correlation filter. For string expressions, the comparison is case-sensitive. When specifying multiple match properties, the filter combines them as a logical AND condition, meaning for the filter to match, all conditions must match.
33+
34+
All filters evaluate message properties. Filters cannot evaluate the message body.
35+
36+
Complex filter rules require processing capacity. In particular, the use of SQL filter rules results in lower overall message throughput at the subscription, topic, and namespace level. Whenever possible, applications should choose correlation filters over SQL-like filters, since they are much more efficient in processing and therefore have less impact on throughput.
37+
38+
## Actions
39+
40+
With SQL filter conditions, and only with those, you can define an action that can annotate the message by adding, removing, or replacing properties and their values. The action [uses a SQL-like expression](service-bus-messaging-sql-filter.md) that loosely leans on the SQL UPDATE statement syntax. The action is performed on the message after is has been matched and before the message is selected into the topic. The changes to the message properties are private to the message copied into the subscription.
41+
42+
## Usage patterns
43+
44+
The simplest usage scenario for a topic is that every subscription gets a copy of each message sent to a topic, which enables a broadcast pattern.
45+
46+
Filters and actions enable two further groups of patterns: partitioning and routing.
47+
48+
Partitioning uses filters to distribute messages across several existing topic subscriptions in a predictable and mutually exclusive manner. The partitioning pattern is used when a system is scaled out to handle many different contexts in functionally identical compartments that each hold a subset of the overall data; for example, customer profile information. With partitioning, a publisher submits the message into a topic without requiring any knowledge of the partitioning model. The message then is moved to the correct subscription from which it can then be retrieved by the partition's message handler.
49+
50+
Routing uses filters to distribute messages across topic subscriptions in a predictable fashion, but not necessarily exclusive. In conjunction with the [auto forwarding](service-bus-auto-forwarding.md) feature, topic filters can be used to create complex routing graphs within a Service Bus namespace for message distribution within an Azure region. With Azure Functions or Azure Logic Apps acting as a bridge between Azure Service Bus namespaces, you can create complex global topologies with direct integration into line of business applications.
51+
52+
## Next steps
53+
54+
To learn more about Service Bus messaging, see the following topics:
55+
56+
* [Service Bus fundamentals](service-bus-fundamentals-hybrid-solutions.md)
57+
* [Service Bus queues, topics, and subscriptions](service-bus-queues-topics-subscriptions.md)
58+
* [SQLFilter syntax](service-bus-messaging-sql-filter.md)
59+
* [How to use Service Bus topics and subscriptions](service-bus-dotnet-how-to-use-topics-subscriptions.md)

0 commit comments

Comments
 (0)