1
votes

Let me start with note that i am completely understand Azure functions and serverless concepts and Azure function's 5 min max time out limit.

If you want to run any jobs more than 10 minutes choose webjobs. Azure functions, runs only for 5 minutes by default, if your process exceeds 5 minutes, then azure function throws timeout exception. You can increase the timeout to 10 minutes in host.json.

Question :

I am try to build following architecture to save cost on azure and want to deploy Spring rest micro service as azure functions.

enter image description here

I have created demo Java Azure function and it's working fine . - Azure Java function -502-Bad Gateway

Now i want to call my API inside of azure functions and also want to use my spring-boot jar (upload jar in storage or any other locations).

Did any one try this and is it possible with Azure java functions ?

1
Not sure if I understand the question. Are you having trouble sending HTTP requests from your Azure Function to your micro-service APIs?Ling Toh
I want to give call my Spring jars inside of function class (get/post) and want to keep my spring jar inside of blob or anyother location where i can save cost,currantly spring jar is running on webapp on azure.vaquar khan

1 Answers

1
votes

Based on the quick research I did, I think we cannot deploy a spring-boot-stater-web project into a Azure Function, I can be wrong.

Anyway we all can agree it is not appropriate. After all application lifecycle of an Azure Function is different from a application server like Tomcat. So it deserves a different programming model.

I believe you can slightly modify your project to use spring-cloud-starter-function-web. Please refer the following sample.

https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-azure

https://cloud.spring.io/spring-cloud-function/#quick-start

https://www.youtube.com/watch?v=DufUqOxlkGk

Another way would be to write your own custom starter and add it to the Azure functions project.

https://www.baeldung.com/spring-boot-custom-starter