如果作业名称在部署时未知,我该如何开始作业?
How do I start a job, when the job name is not known at deployment time?
我正在尝试启动一个批处理作业,这在部署时是未知的。 (管理员用户可以通过 rest-api 定义自己的工作)
我打电话:
JobOperator jobOperator = BatchRuntime.getJobOperator();
-- > Class org.wildfly.extension.batch.jberet.deployment.JobOperatorService -
不允许启动未知作业。
Javadoc 说:
* Note that for each method the job name, or derived job name, must exist for the deployment. The allowed job names and
* job XML descriptor are determined at deployment time.
如何启动部署时未确定的作业?
提前致谢
您可以在批处理作业命名中有一些约定,这样在部署时就可以绕过部署时验证。例如,您可以在您的应用程序中打包一个占位符作业:
<?xml version="1.0" encoding="UTF-8"?>
<job id="submitted-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/jobXML_1_0.xsd" version="1.0">
<!-- this job is defined and submitted dynamically by the client -->
</job>
在运行时,管理员可以动态填写作业内容。
我正在尝试启动一个批处理作业,这在部署时是未知的。 (管理员用户可以通过 rest-api 定义自己的工作) 我打电话:
JobOperator jobOperator = BatchRuntime.getJobOperator();
-- > Class org.wildfly.extension.batch.jberet.deployment.JobOperatorService - 不允许启动未知作业。
Javadoc 说:
* Note that for each method the job name, or derived job name, must exist for the deployment. The allowed job names and
* job XML descriptor are determined at deployment time.
如何启动部署时未确定的作业?
提前致谢
您可以在批处理作业命名中有一些约定,这样在部署时就可以绕过部署时验证。例如,您可以在您的应用程序中打包一个占位符作业:
<?xml version="1.0" encoding="UTF-8"?>
<job id="submitted-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/jobXML_1_0.xsd" version="1.0">
<!-- this job is defined and submitted dynamically by the client -->
</job>
在运行时,管理员可以动态填写作业内容。