I have a long running database task, which can vary from few minutes to few hours depending on the data to be processed. Since the background Task is dependent on the screen . I am calling an ExecutorService from Background Task,so even if the screen is closed the task is not interrupted.
At the end of the process , the ExecutorService process write summarized data into Excel.
First approach is write into separate folder then using fileuploadservice upload the excel file.
Second approach is read the bytes and add using fileloader service ( https://doc.cuba-platform.com/manual-6.6/fileLoader.html )
I prefer the second approach and so i created a Service to perform the operation,but since the service is being called from Core Module , its throwing null pointer exception , where as if i manually call it via web module(screen) its working.
I cannot use AppContext Listener becuase users needs to call this Executor Service again and again using different input parameter.
How can i call Service from Core Module ? Also do you suggest any other better way other than ExecutorService,which cuba supports.