Improved Asadmin Commands
The following is a list of the administration commands that have been introduced or changed from GlassFish in Payara Server to improve the JBatch API.
set-batch-runtime-configuration
- Usage
-
asadmin> set-batch-runtime-configuration --datasourcelookupname="jdbc/default" --executorservicelookupname="concurrent/__defaultManagedExecutorService" --schemaName="APP" --tablePrefix="BJP" --tableSuffix="BJS"
- Aim
-
Configures the batch runtime storage and execution settings.
Command Options
Option | Shortcut | Description | Default | Mandatory |
---|---|---|---|---|
|
N/A |
The instance or cluster to configure |
server |
No |
|
-d |
The JNDI name of the JDBC data source used to store job information |
N/A |
Yes (unless |
|
-x |
The JNDI name of the Managed Executor Service that provides threads for the jobs' execution. |
N/A |
Yes (unless |
|
-n |
The database schema that holds the batch tables. |
APP |
No |
|
N/A |
The prefix to apply to the batch table name. |
N/A |
No |
|
N/A |
Sets the suffix to apply to the batch table name. |
N/A |
No |
purge-jbatch-repository
Since Payara Server 4.1.2.173
- Usage
-
asadmin> purge-jbatch-repository <apptag>
- Aim
-
Purges the current JBatch repository of all jobs scheduled for the referenced application’s tag. The application’s tag is structured like this:
<Configuration Identifier>:<Application Name>__/<Application Name>
Where Configuration Identifier is the identifier of the configuration associated to the instance or cluster where the application is deployed and Application Name is the name of the deployed application.
Example
To remove all current jobs for an application named jbatch-test deployed on the
DAS (server-config
) then run the following command:
asadmin > purge-jbatch-repository "server-config:jbatch-test__/jbatch-test"
The command will remove all current jobs created by the referenced application whether these jobs are running or not. |
If you are having trouble finding the application’s tag for your application, you can get it programmatically on a Java EE application by using the following code: |
import com.ibm.jbatch.container.servicesmanager.ServicesManager;
import com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl;
import com.ibm.jbatch.container.services.IPersistenceManagerService;
...
JobOperator jobOperator = getJobOperator();
Long executionId = jobOperator.start("job-name", new Properties());
ServicesManager manager = ServicesManagerImpl.getInstance();
IPersistenceManagerService ps = manager.getPersistenceManagerService();
String applicationTag = ps.getJobCurrentTag(jobid);
You need to add a dependency to IBM’s JBatch runtime to your project to access the classes mentioned:
<dependency>
<groupId>com.ibm.jbatch</groupId>
<artifactId>com.ibm.jbatch-runtime-all</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
clean-jbatch-repository
Since Payara Server 5.2021.1
- Usage
-
asadmin> clean-jbatch-repository --status COMPLETED|ALL --days <int.value> <JobName>
- Aim
-
The clean-jbatch-repository subcommand deletes records of job executions.
Command Options
Option | Type | Description | Default | Mandatory |
---|---|---|---|---|
|
|
The status of batch jobs executions to which delete the records of. If ALL then all job executions will be deleted, regardless of status. If COMPLETED only job executions that successfully completed will be deleted. |
COMPLETED |
No |
|
Integer |
The number of days previous that the end time of the job execution must be to get deleted. |
1 |
No |
list-batch-jobs
Since Payara Server 5.183
- Usage
-
asadmin> list-batch-jobs --output jobname,appname,instancecount,instanceid, executionid,batchstatus,starttime,endtime,exitstatus --limit <long.value> --offset <long.value> --header true|false <JobName>
- Aim
-
Lists batch jobs and information about them.
Command Options
Option | Shortcut | Description | Default | Mandatory |
---|---|---|---|---|
|
N/A |
The instance or cluster to configure |
server |
No |
|
-l |
Shows detailed information about batch jobs |
false |
No |
|
-0 |
Shows specific information about batch jobs. You can specify information to display by using comma-separarted list. Following are the available values: jobname, appname, instancecount, instanceid, executionid, batchstatus, starttime, endtime, exitstatus |
The jobname and instancecount information are displayed by default |
No |
|
-h |
Option to choose whether column heading should be displayed or not |
false |
No |
|
N/A |
Set number of rows of batch jobs to display |
N/A |
No |
|
N/A |
Set number of rows of batch jobs to skip |
N/A |
No |