This is the the first article for my Real Time Dashboard with Kafka+Spring-boot+Angular+Azure article series. If you missed third arcticle please read the What is the Azure App services here.
When we are developing applications, it is need to be trigger some process or get data. Rather using traditional server based request, Azure function is one of key player in the deployment.It is an event driven, compute-on-demand experience that extends the existing Azure application platform with capabilities to implement code triggered by events occurring in Azure or third party service as well as on-premises systems.
Here in my project I experimented Azure function for generate status of humidity latest data point. I used Linux based Java app to generate status.
Here is the article that I followed make test app. Link I think its better follow this, if you are new to azure functions.
Let’s begin. I assume that you already followed above arcticle. So I’m directly going to implementation and deployment.In order to make it success make sure local environment and azure app are in same JAVA version. I used Java 8.
Step 01: Run below command your project folder location
mvn archetype:generate "-DarchetypeGroupId=com.microsoft.azure" "-DarchetypeArtifactId=azure-functions-archetype"
When its running, at the end it may request information like below
After go to the location folder and open with IDE to add coding implementation. For here I used Visual Studio Code.
you can see the file called Function.java. Here you have to implement the function.
In project building sample code will be generated. You can simply run and check weather it working or not. If its working locally, You can implement your own method.
If it works fine,you can see above output. Then you can check with browser or curl request.
In the implementation, i just modify the end point like below.
After the implementation please build and run locally.If its wok fine, you can deploy to azure.
After deployment completed, it will show the below message.
After you can check with your app service URL.
Another important thing is you have to config CORS in app configuration.Otherwise it will not allowed to access through frontend. You have to config frontend config server.
That’s it. Let’s see the seventh arcticle relate to this project