docs: translate OhMyConfig

This commit is contained in:
tjq 2021-01-10 12:04:23 +08:00
parent 5feaf6106e
commit f34f903947
3 changed files with 22 additions and 18 deletions

View File

@ -130,9 +130,7 @@ public class PowerJobProperties {
private int maxResultLength = 8096; private int maxResultLength = 8096;
/** /**
* If test mode is set as true, Powerjob-worker no longer connects to the server or validates appName. * If test mode is set as true, Powerjob-worker no longer connects to the server or validates appName.
* Test mode is used for conditions that your worker does not need to run the codes, i.e. when you * Test mode is used for conditions that your have no powerjob-server in your develop env so you can't startup the application
* write junit tests in local environment. {@code true} means test mode is enabled. {@code false} means
* normal mode is applied.
*/ */
private boolean enableTestMode = false; private boolean enableTestMode = false;
} }

View File

@ -10,7 +10,7 @@ import lombok.Setter;
import java.util.List; import java.util.List;
/** /**
* Worker 配置文件 * The powerjob-worker's configuration
* *
* @author tjq * @author tjq
* @since 2020/3/16 * @since 2020/3/16
@ -19,34 +19,38 @@ import java.util.List;
@Setter @Setter
public class OhMyConfig { public class OhMyConfig {
/** /**
* 应用名称 * AppName, recommend to use the name of this project
* Applications should be registered by powerjob-console in advance to prevent error.
*/ */
private String appName; private String appName;
/** /**
* 启动端口 * Worker port
* Random port is enabled when port is set with non-positive number.
*/ */
private int port = RemoteConstant.DEFAULT_WORKER_PORT; private int port = RemoteConstant.DEFAULT_WORKER_PORT;
/** /**
* 调度服务器地址ip:port 域名 * Address of powerjob-server node(s)
* Do not mistake for ActorSystem port. Do not add any prefix, i.e. http://.
*/ */
private List<String> serverAddress = Lists.newArrayList(); private List<String> serverAddress = Lists.newArrayList();
/** /**
* 本地持久化方式默认使用磁盘 * Max length of response result. Result that is longer than the value will be truncated.
*/ * {@link ProcessResult} max length for #msg
private StoreStrategy storeStrategy = StoreStrategy.DISK;
/**
* 最大返回值长度超过会被截断
* {@link ProcessResult}#msg 的最大长度
*/ */
private int maxResultLength = 8096; private int maxResultLength = 8096;
/** /**
* 用户自定义上下文对象该值会被透传到 TaskContext#userContext 属性 * User-defined context object, which is passed through to the TaskContext#userContext property
* 使用场景容器脚本Java处理器需要使用oms-worker宿主应用的Spring Bean可在此处传入 ApplicationContext在Processor中获取 bean * Usage Scenarios: The container Java processor needs to use the Spring bean of the host application, where you can pass in the ApplicationContext and get the bean in the Processor
*/ */
private Object userContext; private Object userContext;
/** /**
* 启动测试模式true情况下不再尝试连接 server 并验证appName * Internal persistence method, DISK or MEMORY
* true -> 用于本地写单元测试调试 false -> 默认值标准模式 * Normally you don't need to care about this configuration
*/
private StoreStrategy storeStrategy = StoreStrategy.DISK;
/**
* If test mode is set as true, Powerjob-worker no longer connects to the server or validates appName.
* Test mode is used for conditions that your have no powerjob-server in your develop env so you can't startup the application
*/ */
private boolean enableTestMode = false; private boolean enableTestMode = false;
} }

View File

@ -1,6 +1,7 @@
package com.github.kfcfans.powerjob.worker.common.constants; package com.github.kfcfans.powerjob.worker.common.constants;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter;
/** /**
* 持久化策略 * 持久化策略
@ -8,11 +9,12 @@ import lombok.AllArgsConstructor;
* @author tjq * @author tjq
* @since 2020/4/14 * @since 2020/4/14
*/ */
@Getter
@AllArgsConstructor @AllArgsConstructor
public enum StoreStrategy { public enum StoreStrategy {
DISK("磁盘"), DISK("磁盘"),
MEMORY("内存"); MEMORY("内存");
private String des; private final String des;
} }