chore: worker http support

This commit is contained in:
tjq 2023-01-22 11:15:11 +08:00
parent 5b78204beb
commit 789bcb5d10
4 changed files with 5 additions and 73 deletions

View File

@ -39,6 +39,6 @@ class CSInitializerFactory {
}
}
throw new PowerJobException(String.format("can't load CSInitializer[%s], ensure your package name start with 'tech.powerjob'!", targetType));
throw new PowerJobException(String.format("can't load CSInitializer[%s], ensure your package name start with 'tech.powerjob' and import the dependencies!", targetType));
}
}

View File

@ -1,68 +0,0 @@
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "WARNING"
actor {
# cluster is better(recommend by official document), but I prefer remote
provider = remote
allow-java-serialization = off
serializers {
power-serializer = "tech.powerjob.common.serialize.PowerAkkaSerializer"
}
serialization-bindings {
"tech.powerjob.common.PowerSerializable" = power-serializer
}
}
remote {
artery {
transport = tcp # See Selecting a transport below
# over write by code
canonical.hostname = "127.0.0.1"
canonical.port = 0
}
}
# worker-request-core-dispatcher
w-r-c-d {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
executor = "fork-join-executor"
# Configuration for the fork join pool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 2
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = 4.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 128
}
# Throughput defines the maximum number of messages to be
# processed per actor before the thread jumps to the next actor.
# Set to 1 for as fair as possible.
throughput = 10
}
friend-request-actor-dispatcher {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
executor = "fork-join-executor"
# Configuration for the fork join pool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 2
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = 4.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 128
}
# Throughput defines the maximum number of messages to be
# processed per actor before the thread jumps to the next actor.
# Set to 1 for as fair as possible.
throughput = 5
}
}

View File

@ -9,6 +9,8 @@ powerjob.worker.akka-port=27777
powerjob.worker.app-name=powerjob-worker-samples
# Address of PowerJob-server node(s). Ip:port or domain. Multiple addresses should be separated with comma.
powerjob.worker.server-address=127.0.0.1:7700,127.0.0.1:7701
# transport protocol between server and worker
powerjob.worker.protocol=http
# Store strategy of H2 database. disk or memory. Default value is disk.
powerjob.worker.store-strategy=disk
# Max length of result. Results that are longer than the value will be truncated.

View File

@ -43,19 +43,17 @@
<version>${powerjob-remote-framework.version}</version>
</dependency>
<!-- PowerJob 通讯层具体实现,按需选择自己需要的通讯器即可。如果包冲突可尝试更换通讯器实现 -->
<!-- 4.3.x 版本前 AKKA 都是 PowerJob 通讯层的唯一实现,考虑到兼容性 4.3.x 默认仍为 AKKA但由于 AKKA 后续收费,最终会废弃该模块 -->
<!-- PowerJob 通讯层具体实现,按需选择自己需要的通讯器即可。如果包冲突可尝试更换通讯器实现,并排除未使用的通讯器包 -->
<!-- 4.3.x 版本前 AKKA 都是 PowerJob 通讯层的唯一实现,考虑到兼容性 4.3.x 默认仍为 AKKA但由于 AKKA 后续收费,最终会废弃该模块扶正太子HTTP上位 -->
<dependency>
<groupId>tech.powerjob</groupId>
<artifactId>powerjob-remote-impl-akka</artifactId>
<version>${powerjob-remote-impl-akka.version}</version>
</dependency>
<!-- 4.3.x 版本考虑到兼容性,官方默认实现仍为 akka如需使用 HTTP 请自行引入依赖并修改 worker 启动配置 -->
<dependency>
<groupId>tech.powerjob</groupId>
<artifactId>powerjob-remote-impl-http</artifactId>
<version>${powerjob-remote-impl-http.version}</version>
<scope>provided</scope>
</dependency>
<!-- h2 database -->