Java Reference
In-Depth Information
file), but can be accessed from the job execution. The batching framework calls them
parameters. If you need this kind of logic in your application, you should just pass them
during a job's startup and use the job execution ID to access them:
JobOperator operator = BatchRuntime.getJobOperator();
Properties properties = new Properties();
properties.put("propertyName", "propertyValue");
long jobId = operator.start("externalSystem", properties);
JobExecution execution = operator.getJobExecution(jobId);
Properties jobParameters = execution.getJobParameters();
You can point your browser to http://localhost:8080/ticket-agency-
longterm/rest/job and your batch job should start running! Be sure to set up your
seats before running the job (the console is available at http://localhost:8080/
ticket-agency-longterm/faces/views/setup.xhtml ).
A sample output file in your WildFly's bin directory would look like the following:
Chunk size: 2
Persisted: Seat [id=5, booked=true,
Persisted: Seat [id=6, booked=true,
Chunk size: 2
Persisted: Seat [id=7, booked=true,
Persisted: Seat [id=8, booked=true,
Chunk size: 1
Persisted: Seat [id=9, booked=true,
Import finished
Of course, you could also start the batch job using a Java EE timer after a specific event in
your application or even as an effect of an incoming JMS message. You can also use the
retrieved job IDs to monitor the already running jobs or terminate them on demand. The
Search WWH ::

Custom Search