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?
2
Answers
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.
Is there any attribute in the message header which indicates that the message is from a Create request or Update request?
Question relates to Azure service bus and I think there is no such way (as per my understanding).
Now coming to your requirement, you need create message from crm to go on Create Topic (service bus) and same way with Update message. This can be achieved, you will have to register plugin on create and update trigger for particular entity in crm. In this plugin you will have to connect with your Azure service bus correct topic which you want with SASKey (there are numerous examples) and push the crm message to your service bus topic.
below pseudo code for understanding to send object to service bus. please don’t take as it is, just to show this can be achieved and we did this in one of our project.