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:
Importing...
Chunk size: 2
Persisted: Seat [id=5, booked=true,
seatType=com.packtpub.wflydevelopment.chapter12.entity.SeatType@a55bb6e]
Persisted: Seat [id=6, booked=true,
seatType=com.packtpub.wflydevelopment.chapter12.entity.SeatType@a55bb6e]
Chunk size: 2
Persisted: Seat [id=7, booked=true,
seatType=com.packtpub.wflydevelopment.chapter12.entity.SeatType@440a007]
Persisted: Seat [id=8, booked=true,
seatType=com.packtpub.wflydevelopment.chapter12.entity.SeatType@440a007]
Chunk size: 1
Persisted: Seat [id=9, booked=true,
seatType=com.packtpub.wflydevelopment.chapter12.entity.SeatType@307124b7]
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