Hi @YogeshVEDPATHAK-7786
Welcome to Microsoft Q&A! Thanks for posting the question.
The filter is never be used for filtering based on the content message. Rules/filters work on the specific property that you have defined on the message.
In many scenarios, messages that have specific characteristics must be processed in different ways. To enable this processing, you can configure subscriptions to find messages that have desired properties and then perform certain modifications to those properties. While Service Bus subscriptions see all messages sent to the topic, you can only copy a subset of those messages to the virtual subscription queue. This filtering is accomplished using subscription filters. Such modifications are called filter actions. When a subscription is created, you can supply a filter expression that operates on the properties of the message. The properties can be both the system properties (for example, Label) and custom application properties (for example, StoreName.) The SQL filter expression is optional in this case. Without a SQL filter expression, any filter action defined on a subscription will be done on all the messages for that subscription.
Before sending a message to the service bus you define message properties (any custom field with the value same as MoveToLocation ID in that message) which can be used for filtering the message at the subscription end.
Updated:
I have used service bus explorer to send the test messages with the custom property 'MoveToLocationID'
While sending the message to the topic I have set the MoveToLocationID property as integer value to 3 in the message as it is in the message content. This needs to update/implemented at your sender application end that they should set the custom property with the message value so the filter should work correctly.
At the subscription end, I have deleted the default rule 1=1 (SQL) and added new rule with the below filter:
MoveToLocationID = 5 OR MoveToLocationID = 10
Using the above rule only messages that have MoveToLocationID property with values as 5 and 10 will be accepted and other messages will be discarded at the subscription end where you have applied the above rule.
Hope the above helps and please let me know if you have any queries or concerns.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.