Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jakartabatch-dev] Kick off conversation on next Jakarta Batch release - Jakarta EE 10 ? Batch + CDI integration?

Hi Scott,

Maybe coming from nowhere but personally i'd like jbatch 2 to not inherit from jbatch 1 and be reactive driven.
Overall idea is to be able to use more easily custom flows (by combining CompletionStages).
This has a ton of advantages:

1. Makes the batch writer responsible of the flow (whereas a mix between the runtime and writer),
2. Keep the composability of existing batch "components",
3. Enables to work with any IoC without having to do any integration (batch writer injects what it needs),
4. No need of any batch/job repository (in code veritas est ;)),
5. Enables to be more efficient in more and more common "remoting first" batches we meet with microservices (ie leverage NIO more than in current synchronous API),
6. Makes the testing way easier: myBatch.userStart().toCompletionFuture().get();

The main missing piece is the persistence of the steps+overall batch state(s) and some controller (to stop a running batch for example).

Indeed JBatch 2 can be a BatchController { saveStepState(...); saveBatchState(...) } etc but thinking more in terms of events sounds more natural (we can start by CDI events since it is about jakarta but implementations can wire events on what they desire).

To rephrase it a bit more clearly: JBatch wouldn't be a runtime with very low value as of today but the actual infrastructure API (persistence mainly and state "isBatch(key, STOPPED)").

In terms of API the only small challenges are to enable to inject into a promise flow these persistent steps properly and to probably enable to orchestrate more easily chunking and so (even if Stream API kind of enables it but it misses some Iteration object to make it easier) but overally it does not sound crazy:

final var batch = jbatch.startingBatch("my-batch");
final var batchPromise = batch.wrapStep("step 1 name", fetchData())
  .thenApply(read -> batch.wrapStep("step 2 name", processData(read)));

and so on.

Does it make sense or is JBatch stucked on container+synchronous current design?

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book


Le mar. 23 mars 2021 à 14:05, Scott Kurz <skurz@xxxxxxxxxx> a écrit :
Hi all,

I hope everyone is doing OK and making it through the pandemic as well as possible.

I'd like to kick off conversation on the next Batch release here.  It is finally time to look at adding new function ! 

While it's natural to approach this as "a Batch update for Jakarta EE 10",  I think we have to dive into discussion of the issues, build some momentum, and see what pace we can maintain before committing to any kind of plan.

But ideally a release should mix:
  1)  Major items        2)   Minor API enhancements/tweaks        3)  Other enhancements - e.g. automation / infrastructure / process, etc.

So in my mind that'd look something like:

Major items
* Better CDI integration -  (e.g. these issues as starting points:  https://github.com/eclipse-ee4j/batch-api/issues?q=is%3Aissue+is%3Aopen++cdi)
* Support for generics - https://github.com/eclipse-ee4j/batch-api/issues/13
* Support for Java-defined job (not just XML-defined) https://github.com/eclipse-ee4j/batch-api/issues/109
* Better Properties injection - https://github.com/eclipse-ee4j/batch-api/issues/133,   https://github.com/eclipse-ee4j/batch-api/issues/95, https://github.com/eclipse-ee4j/batch-api/issues/43,  https://github.com/eclipse-ee4j/batch-api/issues/82    (We probably should also be looking at MicroProfile Config and the future of MicroProfile + Jakarta convergence)
* Clarify Persistent user data https://github.com/eclipse-ee4j/batch-api/issues/131

Minor items   - We have a large list of suggestions piled up in:   https://github.com/eclipse-ee4j/batch-api/issues

Other
* Enhance the EE TCK in https://github.com/eclipse-ee4j/batch-tck so we can stop having to do a second, duplicate contribution to the https://github.com/eclipse-ee4j/jakartaee-tck/ possibly as the JUnit 4 extension Romain outlined which we haven't followed up on.
* Continue to plug gaps in TCK coverage and add new tests cases for old function
--------

So that's a big list and already likely more than could fit into a next release, given we're starting from a pace of zero.

However, I don't think we should go further, without first talking about Jakarta Batch + CDI integration.

The subject takes us back to the JSR 352 legacy where the Expert Group, including IBM, Pivotal / VMWare, and others, laid the groundwork for the collaboration by purposely not requiring use of a specific dependency injection technology, and so did not define Batch + CDI integration.    Anyone familiar with the JSR would observe, and we fully acknowledge the major portion of JSR 352 modeled after Spring Batch, and we have all appreciated and benefited from this contribution.

But I do think we need to reconsider this topic to make the right decision now for how to standardize Jakarta Batch + Jakarta CDI going forwards.   We should have this conversation upfront, before we invest more time in any of the other details.

E.g. some rough ideas would be:

1. Support for Jakarta Batch + CDI is required
2. Support for Jakarta Batch + CDI is optional
3. Support for Jakarta Batch + CDI is required, "in the presence of a CDI runtime"  (whatever that means, obviously would need clarification)

So for now I'm hoping to launch the discussion, and to take whatever time we need for those interested to join in.

Looking forward to hearing your thoughts,
------------------------------------------------------
Scott Kurz
WebSphere / Open Liberty Batch and Developer Experience
skurz@xxxxxxxxxx
--------------------------------------------------------

_______________________________________________
jakartabatch-dev mailing list
jakartabatch-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jakartabatch-dev

Back to the top