Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jakartabatch-dev] Wish: Java based job configuration

To me, this is right on the money for what I had hoped for in the Java EE 8 time frame. Is someone from Red Hat present here to help standardize something like this?

Reza Rahman
Jakarta EE Ambassador, Author, Blogger, Speaker

Please note views expressed here are my own as an individual community member and do not reflect the views of my employer.

On 2/5/2020 12:38 PM, Martijn Dashorst wrote:
JBeret does have a concept of Java based job construction using builders. While I can go on about that particular API, it does the job.

That said, the specification does not have any documented affordances for Java based job specification. Everything needs to be done through the JSL.

Wildfly provides its own implementation/wrapper for the parts where application code needs to submit jobs, but as the spec doesn't have a way to start a Java based job, I can't use that.

For example, we use CDI quite extensively, and wiring things together using CDI and annotations is quite natural for our Java developers.

As code speaks more than a 1000 words: here's some example code I'd like to be able to write for batch jobs:

@ApplicationScoped
public class ExampleJob
{
@Produces
@Named("exampleJob")
public Job createExampleJob()
{
return new JobBuilder("exampleJob").step(new StepBuilder("exampleStep")
.batchlet(ExampleStep.class.getName())
.build()).build();
}
@Inject
private JobOperator operator;

@Inject
@Named("exampleJob")
private Job exampleJob;

public void startExampleJob() {
Properties pars = new Properties();
pars.addProperty("par1", "foo");

operator.start(exampleJob, pars);
}
}

The properties necessary for providing parameters to a job is also something I'd like to be able to fix.

The wildfly joboperator assumes all configuration is done through the JSL, even though their JavaDoc states that the job definition needs to be available at deployment time. My example does seem to satisfy that requirement, but it doesn't work, as wildfly doesn't register the job because it doesn't exist in XML.


Martijn Dashorst


_______________________________________________
jakartabatch-dev mailing list
jakartabatch-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jakartabatch-dev


-- 
Reza Rahman
Principal Program Manager
Java on Azure

Please note that views here are my own as an individual community member and do not represent the views of my employer.

Back to the top