I am having an lamda function that is calling for creating a excel.
When call hit first thing i am creating an entry in status table and returning status id as response
I have a poll api that can be hit with this id to check the percentage completed.
Just before i return the response i am starting a thread like this
Runnable runnable = () -> {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("SHEET 1");
//code for creating the excel and saving to s3. And i am updating the percentage in equal intervals
};
new Thread(runnable).start();
But when thread start it is stuck at the like XSSFWorkbook workbook = new XSSFWorkbook(); not proceeding from there. If i move this line outside to thread then the flow is stuck in next line workbook.createSheet(“SHEET 1”); basically all lines realted to create row or create cell
Any solutions
I tried removed the entire code block of excel creation outside the thread and it works. Eventhough the gateway timeout is 29 seconds it leads to time out but in background the file is created and uploaded to s3 and status is updated till 100%