Start batch job execution from WildFly remote ejb client
$JBOSS_HOME/bin/add-user.sh -a -u user1 -p user1
mvn clean package
mvn wildfly:deploy
# to run client program as a guest without providing username:
mvn exec:exec
# to run client program as user1:
mvn exec:exec -Duser=user1 -Dpassword=user1
The client program calls a remote EJB, which in turn starts running the batch job named job1
.
After some duration, the job execution should complete successfully.
In additional, you may want to experiment with server suspend and resume, and see how the running batch job execution is stopped during suspending, and automatically restarted during server resume.
Right after running the above client program, suspend the server with the following CLI command:
$JBOSS_HOME/jboss-cli.sh --connect
[standalone@localhost:9990 /] :suspend
{"outcome" => "success"}
Notice in the server log are some log entries indicating the server is being suspending, and the running batch job execution is being stopped.
[standalone@localhost:9990 /] :resume
{"outcome" => "success"}
Verify in the server log that the stopped job execution is automatically restarted, from where it left off.
mvn wildfly:undeploy