Integration using Azure service topics with D365F&O, using Azure functions: a strategy, Part-1

 



We all know and have worked a lot with Azure Service Bus: queues, topics, and the tattletale around them. Given the rich set of advantages (dead lettering, decoupled applications, load balancers, safety routing -- only to name a few)you could get from them, ASBs are really becoming more and more a very powerful Azure component to consume and deal with. The following article explains how you can use ASBs, to make your Azure function listen to them, and then talk to D365F&O -- in a most cost effective way.

Step 1: Creating an Azure service bus namespace:

You can create a ASB by simply launching from Azure Portal, and selecting the essential elements which you need, as per your business requirement. 


Enter/select a resource group, give a namespace name. Select: Pricing tier = 'Premium'. Selecting 'Basic' or 'Standard' or enable the Queue option, otherwise. 

Post this, additionally you can check if you need to specify anything explicitly, by clicking on 'Advanced' or else you can directly go for creating the namespace. The namespace would take some moments to deploy.

Your Namespace is now ready to be used.



Step2: create a topic:

In this, we will create a new topic, by creating on the following button from the action pane:


The following popup opens. Fill them up as needed. Don't forget to enable 'auto-delete on idle topic' and as highlighted:



Click 'Create' to complete the step. The step will take a couple of moments to validate the keyed-in values and then will create the topic for you. 

How to view the created Topic?



On the side pane, click on the 'Topics' and you will see the list of all the topics that have been created (selecting a different Pricing tier, other than 'premium' would have just given us 'Queues', and not 'Topics').

Here is our newly created Topic:

Uploading: 25695 of 25695 bytes uploaded.


Step 3: Create a Subscription
Click on it to view details. Click on +Subscription, to add a new subscription: Give a name = D365FO_Subscription, select 'Enable dead lettering on message expiration' and rest you can leave with default values. Click 'Create' to finish the step. This will create the Subscription and you can view it at as follows:



Click on it to view the details. Here we will create the 'Correlation' filter and this is the most interesting part of the entire story.

Step4: Creating a filter

In the following screen, click on 'Add filter':


From the following screen, select 'Correlation filter'. Select 'Label' from the dropdown and give a suitable identifier label to your message:


Click to save changes.

Like this you can create as many message label filters as possible. The idea is to 'filter' only the customer records/vendor records/pools records as per recipient's wish -- not to cross listen to any unwanted data.







How this works

Reach out to Topics\D365FO -->Service bus explorer --> select a subscription --> D365FO_Subscription:

You can Send a message from here --> click on "Send Messages" --> the following popup opens:



Select content-type: application/JSON. Go to the bottom --> expand: Broker properties, to set the label of desired value:


Which enables it to be used as a SalesPool type of message. Click Send.

Come back to your Service bus explorer, select 'Receive message' from 'Peek mode' drop down:



Click on 'Receive message' -> it will download only the intended labelled message (in our case SalesPool). In case of any other labelled message is there, it will simply filter out:



Additionally, as you turned on Dead-lettering, it will expire the message if unattended after a given time, and also you can peek messages from the start ( receiving the message means it will read the message just once for you, you might not be able re-read again. Peeking can let you read any message, starting from the start).

So much for today. In part-2, we will see how could this be made to tap on to Azure function, to make it to talk to D365FO.

Comments

Popular posts from this blog

X++ : mistakes which developers commit the most

Make your menu items visible on main menu, conditionally,, using this cool feature of D365FO

Speed up your execution performance by using SysGlobalCaches