Search code examples
azure-servicebus-topicsazure-queues

Filter Xml messages on element presence in Azure Topic


I have an Azure topic and want to filter messages on their XML elements.

<stay>
  ...
</stay>

vs

<flee>
  ...
</flee>

I have understood the SqlFilter is the way to go, but found no information on how to filter on the presens of an element.


Solution

  • You cannot filter messages based on the payload. SQL Filters work on headers / properties of the message, not message body. A potential way of achieving what you need is to stamp message headers with the appropriate information for SQL Filters to operate on. A few samples available in the official documentation.