Improved Asadmin CLI 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-Jakarta EE API/JBatch API-repository
- Usage
-
asadmin> purge-Jakarta EE API/JBatch API-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 Jakarta EE API/JBatch API-test deployed on the DAS (server-config
) then run the following command:
asadmin > purge-Jakarta EE API/JBatch API-repository "server-config:Jakarta EE API/JBatch API-test__/Jakarta EE API/JBatch API-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.Jakarta EE API/JBatch API.container.servicesmanager.ServicesManager;
import com.ibm.Jakarta EE API/JBatch API.container.servicesmanager.ServicesManagerImpl;
import com.ibm.Jakarta EE API/JBatch API.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.Jakarta EE API/JBatch API</groupId>
<artifactId>com.ibm.Jakarta EE API/JBatch API-runtime-all</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
[[clean-Jakarta EE API/JBatch API-repository]]
== clean-Jakarta EE API/JBatch API-repository
Usage::`asadmin> clean-Jakarta EE API/JBatch API-repository --status COMPLETED|ALL --days <int.value> <JobName>` Aim:: The clean-Jakarta EE API/JBatch API-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
- 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-separated list. Available values are:
|
|
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 |