Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jakartabatch-dev] Remote start / submit of Java-defined jobs?

Hi Scott,

Guess the one making the most sense is the named based option which is mainly exactly the same as the XML DSL one but in plain java (yeah :)).

If done then it also enables the define and run case thanks the operator but has the pitfall to almost quit the recurrent side of batches (to look like a one time job) which makes it leaving jbatch for me and more in a scheduler/plain java thing.

So overall it means it is just a matter of registering a job but not launching and if launch is desired it can be done already in one more line:

void launchAtStartup(@Observes JobRegistrationCallback cb, JobOperator op) {
   // define
    cb.defineJob("my-job")
       .batchlet("exec", ....);

    // start if needed - or let a scheduling trigger it elsewhere (quartz for ex)
    final var id = op.start("my-job", null); // immediately launch the job

    // optionally await somehow the end for "batch process" and not long running instances
    JobOperatorAwaiterHelper.toCompletionStage(id).whenComplete((r, e) -> ...); // can be neat to support CompletionStage like that in the API somehow
}

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


Le jeu. 1 avr. 2021 à 14:49, Scott Kurz <skurz@xxxxxxxxxx> a écrit :

I wanted to call out a point on the ML here, on the Java-defined job: https://github.com/eclipse-ee4j/batch-api/issues/109

Are we just looking to provide an API to dynamically construct a job and then go and immediately execute it?

I'm sure that'd be useful. I mean to say, are we ALSO looking to provide an API to "register" the job by name so that it could be easily invoked later, by name and job params, for example?

Using the existing interface for starting an XML-defined job:
start(String jobXMLName, Properties jobParameters)
it's certainly easy to expose that remotely.


I haven't looked at the existing implementations and their approaches yet.

But wondering what people were thinking this would look like?

------------------------------------------------------
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