diff --git a/README.md b/README.md
index d9d7216..454d32c 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ allprojects {
#### build.gradle
```kotlin
dependencies {
- implementation ("com.github.Areeb-Gillani:vertx-boost:1.0.1")
+ implementation ("com.github.Areeb-Gillani:vertx-boost:1.0.2")
}
```
#### pom.xml
@@ -43,7 +43,7 @@ dependencies {
com.github.Areeb-Gillani
vertx-boost
- 1.0.1
+ 1.0.2
```
@@ -53,7 +53,7 @@ Vertx says that every class that extends AbstractVerticle will be handled by its
```json
{
{...},
- "workers":{
+ "ServiceUnits":{
"ExampleWorker":{
"instance":5,
"poolSize":6
diff --git a/src/main/java/io/github/areebgillani/boost/BoostApplication.java b/src/main/java/io/github/areebgillani/boost/BoostApplication.java
index 6eadf2c..3d3652c 100644
--- a/src/main/java/io/github/areebgillani/boost/BoostApplication.java
+++ b/src/main/java/io/github/areebgillani/boost/BoostApplication.java
@@ -81,9 +81,9 @@ public void deployApplication(String folderPath, Boolean isClustered) throws Exc
booster.boost(this.getClass().getPackage().getName());
if(isClustered)
clusteredVertx = VertxClusterUtils.initClusterVertx(config, vertxOptions);
- booster.getServiceWorkerList().forEach(service->{
+ booster.getServiceUnitList().forEach(service->{
try {
- deployServices(service.getGlobalConfig(), service.getServiceSupplier(), service.getWorkerName(), service.getWorkerConfig());
+ deployServices(service.getGlobalConfig(), service.getServiceSupplier(), service.getServiceUnitName(), service.getServiceUnitConfig());
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -127,21 +127,21 @@ public ConfigRetrieverOptions initRetrieverConfig(String folderPath) {
.setConfig(new JsonObject().put("path", folderPath == null || folderPath.isEmpty() ? "config.json" : folderPath)))
.addStore(new ConfigStoreOptions().setType("sys"));
}
- private void deployServices(JsonObject config, Supplier serviceSupplier, String workerName, JsonObject workerConfig) {
+ private void deployServices(JsonObject config, Supplier serviceSupplier, String serviceUnitName, JsonObject serviceUnitConfig) {
vertx.deployVerticle(serviceSupplier, new DeploymentOptions()
.setConfig(config)
- .setWorkerPoolName(workerName)
- .setWorkerPoolSize(workerConfig.getInteger("poolSize", 20))
- .setInstances(workerConfig.getInteger("instance", 5))
- .setThreadingModel(switch (workerConfig.getString("type", "W")) {
+ .setWorkerPoolName(serviceUnitName)
+ .setWorkerPoolSize(serviceUnitConfig.getInteger("poolSize", 20))
+ .setInstances(serviceUnitConfig.getInteger("instance", 5))
+ .setThreadingModel(switch (serviceUnitConfig.getString("type", "W")) {
case "EL": yield ThreadingModel.EVENT_LOOP;
case "VT": yield ThreadingModel.VIRTUAL_THREAD;
default: yield ThreadingModel.WORKER;
}), res -> {
if (res.succeeded())
- logger.info(workerName+" successfully deployed.");
+ logger.info(serviceUnitName+" successfully deployed.");
else
- logger.error(workerName+" deployment failed." + res.cause());
+ logger.error(serviceUnitName+" deployment failed." + res.cause());
});
}
private void deployHttpService( Supplier serviceSupplier, int instances, int port) {
diff --git a/src/main/java/io/github/areebgillani/boost/Booster.java b/src/main/java/io/github/areebgillani/boost/Booster.java
index baaf885..05b96c8 100644
--- a/src/main/java/io/github/areebgillani/boost/Booster.java
+++ b/src/main/java/io/github/areebgillani/boost/Booster.java
@@ -2,9 +2,8 @@
import io.github.areebgillani.boost.aspects.*;
import io.github.areebgillani.boost.pojos.EndPointController;
-import io.github.areebgillani.boost.pojos.ServiceWorker;
+import io.github.areebgillani.boost.pojos.ServiceUnit;
import io.vertx.core.DeploymentOptions;
-import io.vertx.core.ThreadingModel;
import io.vertx.core.Verticle;
import io.vertx.core.Vertx;
import io.vertx.core.impl.logging.Logger;
@@ -26,7 +25,7 @@ public class Booster {
Logger logger = LoggerFactory.getLogger(Booster.class);
private final HashMap controllerInstanceMap = new HashMap<>();
private final HashMap> endPointControllerMap = new HashMap<>();
- private final List serviceWorkerList = new ArrayList<>();
+ private final List serviceUnitList = new ArrayList<>();
String basePackage;
Vertx vertx;
JsonObject config;
@@ -68,7 +67,7 @@ private void scanServices() {
Reflections reflections = new Reflections(basePackage);
Set> services = reflections.getTypesAnnotatedWith(Service.class);
Set> repos = reflections.getTypesAnnotatedWith(Repository.class);
- JsonObject workers = config.getJsonObject("workers");
+ JsonObject serviceUnits = config.getJsonObject("ServiceUnits");
for (Class> service : services) {
Supplier myService = () -> {
try {
@@ -84,8 +83,8 @@ private void scanServices() {
throw new RuntimeException(e);
}
};
- String workerName = getWorkerName(service);
- serviceWorkerList.add(new ServiceWorker(config, myService, workerName, workers.getJsonObject(workerName)));
+ String serviceUnitName = getServiceUnitName(service);
+ serviceUnitList.add(new ServiceUnit(config, myService, serviceUnitName, serviceUnits.getJsonObject(serviceUnitName)));
}
}
@@ -114,7 +113,7 @@ private void initRepositoryVariable(Set> repos, Object serviceInstance,
}
}
- private String getWorkerName(Class> service) {
+ private String getServiceUnitName(Class> service) {
for (Annotation annotation : service.getAnnotations()) {
if (annotation instanceof Service serv)
return serv.value();
@@ -130,7 +129,7 @@ public HashMap getControllerInstanceMap() {
return controllerInstanceMap;
}
- public List getServiceWorkerList() {
- return serviceWorkerList;
+ public List getServiceUnitList() {
+ return serviceUnitList;
}
}
diff --git a/src/main/java/io/github/areebgillani/boost/pojos/ServiceWorker.java b/src/main/java/io/github/areebgillani/boost/pojos/ServiceUnit.java
similarity index 51%
rename from src/main/java/io/github/areebgillani/boost/pojos/ServiceWorker.java
rename to src/main/java/io/github/areebgillani/boost/pojos/ServiceUnit.java
index ab48c02..7df3506 100644
--- a/src/main/java/io/github/areebgillani/boost/pojos/ServiceWorker.java
+++ b/src/main/java/io/github/areebgillani/boost/pojos/ServiceUnit.java
@@ -5,17 +5,17 @@
import java.util.function.Supplier;
-public class ServiceWorker {
+public class ServiceUnit {
JsonObject globalConfig;
Supplier serviceSupplier;
- String workerName;
- JsonObject workerConfig;
+ String serviceUnitName;
+ JsonObject serviceUnitConfig;
- public ServiceWorker(JsonObject globalConfig, Supplier serviceSupplier, String workerName, JsonObject workerConfig) {
+ public ServiceUnit(JsonObject globalConfig, Supplier serviceSupplier, String serviceUnitName, JsonObject serviceUnitConfig) {
this.globalConfig = globalConfig;
this.serviceSupplier = serviceSupplier;
- this.workerName = workerName;
- this.workerConfig = workerConfig;
+ this.serviceUnitName = serviceUnitName;
+ this.serviceUnitConfig = serviceUnitConfig;
}
public JsonObject getGlobalConfig() {
@@ -34,19 +34,19 @@ public void setServiceSupplier(Supplier serviceSupplier) {
this.serviceSupplier = serviceSupplier;
}
- public String getWorkerName() {
- return workerName;
+ public String getServiceUnitName() {
+ return serviceUnitName;
}
- public void setWorkerName(String workerName) {
- this.workerName = workerName;
+ public void setServiceUnitName(String serviceUnitName) {
+ this.serviceUnitName = serviceUnitName;
}
- public JsonObject getWorkerConfig() {
- return workerConfig;
+ public JsonObject getServiceUnitConfig() {
+ return serviceUnitConfig;
}
- public void setWorkerConfig(JsonObject workerConfig) {
- this.workerConfig = workerConfig;
+ public void setServiceUnitConfig(JsonObject serviceUnitConfig) {
+ this.serviceUnitConfig = serviceUnitConfig;
}
}