quarkiverse / quarkus-jberet

Quarkus Extension for Batch Applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Start Job using org.jberet.job.model.Job object

falcantaracano opened this issue · comments

Do you have plans to allow start a programmatically defined Job using the classes for org.jberet.job.model?

No. But if there is interest on it I may consider it.

Can you please details your use case? Thanks!

Hi Roberto,

I have an application that runs periodically. The period of time between executions is usually one month.
In each execution, it loads the content of three different files into a database. Additionally, it loads all files of a variable number of periods. This number can vary between 3 and 12 periods. All this information upload is done in two steps. First, the files of the last period are loaded in parallel. Subsequently, all the files of the previous periods, indicated in a configuration parameter (number of periods to load). For this last step, a job is defined programmatically that has a split for parallel loading of several flows. There are a flow for each file to load of the number of previously configured periods.

Feel free to ask if you have any questions about this use case.

Sinceraly,

Fernando

I see.

I guess that you use the JBeret start method that takes a Job. The JobOperator that we expose is a subclass of AbstractJobOperator which includes the method. So if you cast it, you should be able to add the programmatic Job. I can try to add a test to see if that work. Or maybe you can try it and submit a PR? :)

Does this help: 24d60b7?

Hi Roberto,

My proof of concept runs perfectly with your previous comment about AbstractJobOperator casting. After, looking for doing a test to share with you, I have seen the example that you just commented. It's very similar to my example. The difference is that I run my example from a command-cli application using picocli instead of REST services. If you are interested in this type of example, I can provide it to you.

Thank you very much for help.

Sinceraly

Fernando

Sorry, my example is a command-line application, no a command-cli application.

Great. Feel free to send a PR with the example. Maybe we can also improve the API a little bit so it doesn't require so many casts.