Paul
Paul

Reputation: 3253

Simple filter in Service Bus Rule not working

I have a really simple requirement to setup a rule on a subscription so that if priority is LOW a message is picked up. I didnt expect this to be difficult to do and it just doesnt work

My message is below

{
  "messageId": "90db0000-d0ef-aeb6-cb37-08d86a2d0015",
  "conversationId": "90db0000-d0ef-aeb6-6512-08d86a2d0018",
  "sourceAddress": "ADDRESS",
  "destinationAddress": "sb://MYBUS.servicebus.windows.net/my-topic",
  "messageType": [
    "urn:message:Messaging.Services.Models:MyMessage"
  ],
  "message": {
    "messageIdentifier": "f79345cb-ce6a-445c-85b6-d8003eb52046",
    "priority": "LOW"
  },
  "sentTime": "2020-10-06T19:21:18.0426039Z",
  "headers": {},
  "host": {
    "machineName": "MACHINE",
    "processName": "Application",
    "processId": 27640,
    "assembly": "Application",
    "assemblyVersion": "1.0.0.0",
    "frameworkVersion": "3.1.8",
    "massTransitVersion": "7.0.4.0",
    "operatingSystemVersion": "Microsoft Windows NT 6.2.9200.0"
  }
}

I thought that the syntax is as simple as message.priority = "LOW"?

I then tried creating a rule against the message body itself, filtering on destinationAddress, that didnt pick up any messages either

This is really frustrating please can someone help?

I am using Service Bus Explorer

Paul

Upvotes: 0

Views: 584

Answers (2)

Rimaz Mohommed
Rimaz Mohommed

Reputation: 1394

Agree with the previous answer. From the MS Docs > All filters evaluate message properties. Filters can't evaluate the message body. See here : https://learn.microsoft.com/en-us/azure/service-bus-messaging/topic-filters

Upvotes: 1

Sean Feldman
Sean Feldman

Reputation: 25994

Azure Service Bus filters operate on headers/properties and cannot access the message body/payload. You'd need to promote the message:priority into the header.

Upvotes: 0

Related Questions