jakartaee / batch

The Jakarta Batch project produces the Batch Specification and API.
https://projects.eclipse.org/projects/ee4j.batch
Apache License 2.0
13 stars 17 forks source link

Add a Java job definition API as an alternative to XML #109

Open m-reza-rahman opened 4 years ago

m-reza-rahman commented 4 years ago

The Batch API currently only supports defining jobs in XML. While this is workable, many developers prefer to provide configuration via Java instead of XML. This alternative is generally more concise, more type-safe and also allows for conditional configuration more easily. Hence, the Batch API should consider adding a Java job definition API as an alternative to XML. Some Batch API implementations already provide this option in non-standard ways.

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.

scottkurz commented 4 years ago

Thanks for opening Reza.

I'm interested how batch properties would work with this type of API. E.g. would I be expected to call a setBatchProperty(name,value) for every single artifact that needed a given property or would there be some scoping mechanism involved. One angle I'm interested here in https://github.com/eclipse-ee4j/batch-api/issues/95. At the moment BatchProperty injection values come via the XML-defined job property scope hierarchy, combined with job parameters passed on the execution start. But maybe some type of property bean with a specified scope would be helpful from both of these angles?

rmannibucau commented 4 years ago

What we did in batxhee is to generate a jaxb model of the dsl and let it be instantiated programmatically. Can need some fluent love but is a good start. With cdi, an option is to produce a jon directly.

mminella commented 4 years ago

Before addressing this, I think adding generics back to the API would be a pre-req...

scottkurz commented 3 years ago

Opened https://github.com/eclipse-ee4j/batch-api/issues/177 since a job registration mechanism would make this API more useful, but it's probably not a hard dependency.

scottkurz commented 2 years ago

Seems we're not going to get to this in 2.1.