Integrating with NAV is easy and Microsoft have done a great job in providing multiple ways of doing so.
There may come a time when integrating with an external application becomes so intensive that using the standard methods are not optimal. Scaling Up your instance is one way, but this can become a costly exercise. Another way is to provide your integration data to Cosmos DB where it can easily Scale Out providing better global performance and latency with less overhead on your NAV instance.
This blog will show you how to provide your data to Azure Cosmos DB from NAV.
Please Note: Any coding below is just for demonstration. It is by no means something that is for a live environment.
Your customer is complaining that the performance of their website that requests data from NAV is slow. You decide to use Cosmos DB to store item and pricing information. This way the website can request data from multiple regions around the world where the web site is running.
To get things up and running you’ll need the following:
· An Azure Subscription
· Microsoft Dynamics NAV 2018 with the Modern Development Environment ready to go.
Azure Cosmos DB is a globally distributed, multi-model database service.
1. In your Azure Portal create a new Cosmos DB Account.
2. Access the quick start section to create your collections. This is will also give you sample applications in different languages to view the information using .Net, Xamarin, Jana, Node.js and Python.
The quick start should create for you a new cosmos database called ToDoList and a collection called Items. See the picture below:
The next step is to create an Azure function to process requests that will come from NAV and then put them into Cosmos DB. This was by far the easiest way I found to get the data into Cosmos DB by NAV just invoking the function.
//Please Note: You may need to sleep the thread if you are on a clow Cosmos DB plan.
until (items.Next = 0) or (iCounter = 10); // or ten iterations only
Message('Documents have been sent to CosmosDB');
Technology is changing so fast and being able to incorporate this change into your development experience not only will enrich you, but will also maximize the value you can provide to customers. This blog is but just one thing that brings NAV data into Azure in a way that other applications can use on a global scale.
If you like this blog, please be sure to let me know and I’ll gladly share more.