Within my Java batch job (JSR-352, JBeret) I have reached a point where I (optionally) would like to wait for a user decision. According to my research, the JSR-352 specification does not provide a "waiting" concept. So the question is, what other options are there?
My current considerations:
- I'd prefer not to split the job as this would require to maintain the connection between the parts for monitoring needs.
- To introduce JMS into the project only for this purpose seems somewhat overkill.
- Polling the database via JPA or JDBC doesn't seem like a nice solution either.
- The specific information is not yet available when the job is started, it, therefore, cannot be passed as a job parameter.
import javax.batch.api.Decider;
import javax.batch.runtime.StepExecution;
import javax.inject.Named;
@Named
public class AwaitingDecider implements Decider {
@Override
public String decide(final StepExecution[] executions) {
String decision = // how to wait here?
return decision;
}
}