Search code examples
azuredynamics-crmazureservicebus

Filtering of messages posted from Dynamics 365 to Azure Service Bus


I need to post messages from Dynamics 365 to a Azure service bus topic and process that via a Azure function reading from a topic subscription. I have successfully achieved that. The messages that are posted from dynamics come from two types of operations: Create and Update.

I need to set up filters on the topics so that each of the topics (one for create and another for update) have only the messages that satisfy the filter criteria. The message payload coming from Dynamics (via Plugin Registration Tool Service EndPoint Registration) have an attribute indicating if the payload is from a create or update operation. I understand that the filters on topics can be set only for message headers and not the payload.end point registration screenshot

Is there any attribute in the message header which indicates that the message is from a Create request or Update request? Or is there a way to look at the message coming from dynamics to the service bus along with its headers?


Solution

  • After a message gets to the Azure Service bus (configuration for which is shared in the question post), the preview feature allows us to peek at the messages that have arrived. We also have the option to look at the message properties, refer screenshot Message Propereties. From there, I could figure out that there was custom property which was indicating if the message was a Create or Update and by using that I setup a SQL filter and the messages were getting filtered successfully.