purge-jbatch-repository
Purges the current Jakarta Batch repository.
Description
The purge-jbatch-repository
subcommand will purge the current Jakarta Batch repository of all jobs scheduled for the referenced application’s tag.
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);
If using Maven, you’ll have to add a dependency to IBM’s JBatch Container Runtime to your project to access the classes referenced above:
<dependency>
<groupId>com.ibm.jbatch</groupId>
<artifactId>com.ibm.jbatch.container</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
Options
- asadmin-options
-
Options for the
asadmin
utility. For information about these options, see theasadmin
help page. --help
-?
-
Displays the help text for the subcommand.
Operands
- app-tag
-
The application tag whose Jakarta Batch jobs will be purged from the repository.
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.
See the description of the command on how to acquire the application’s tag in a programmatic manner.
Examples
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"