Home > Enterprise >  How to automate user actions on Tomcat/Java application from backend, on Azure?
How to automate user actions on Tomcat/Java application from backend, on Azure?

Time:04-04

I have an application running on Azure PaaS (Tomcat) using Java, JSP and Azure SQL Database.

Users login to the application using a Web Browser and can then run a report, which involves using java to (i) extract data from the database, (ii) process it (iii) create an Excel file using Apache POI.

How is it possible to automate this process on a daily process from the backend?

Here are my ideas so far.

  1. I discount using Azure Logic Apps as a complete solution as I need access to the java code in my application that creates the report.

  2. I could copy and paste the report-generating code into an Azure Function and then automate this code using an Azure Logic App, but having duplicated code is obviously messy.

  3. I could use some kind of automated testing tool (such as Selenium, or write my own) running on a separate machine to login to the system and extract the report, but this is also not so reliable, and requires a separate machine. I would prefer to do this on the backend.

  4. Creating a servlet in the Java to execute the report without logging in, and then calling it via a Azure Logic App. (And blocking the servlet from public Internet access)

Does anyone have a neat solution?

CodePudding user response:

Use a scheduler like quartz library. If your starting writing the app now I would say use spring boot. (Has multiple advantages, using it in 5 weapons that are in Prod, all running well. Optimizations were done in Persistence and network layers)

Spring uses quartz too. Anyway there are many ways to use quartz, but basically a method of your code will be called by it on the designated date/time/ frequency. Like once a day at 8am. That function can trigger out the tasks to create your report, ftp, email it and other backend tasks.

Don't use selenium ...not the right tool for this requirement.

  • Related