Skip to content

Commit

Permalink
- Threading model support added on service level
Browse files Browse the repository at this point in the history
- Redundant code removal
  • Loading branch information
Areeb-Gillani committed Dec 25, 2024
1 parent 5f88824 commit 70f84d6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ plugins {
}

group = "io.github.areebgillani"
version = "1.0.0"
version = "1.0.1"
version = "1.0.2"
val vertxVersion = "4.5.8"
publishing {
publications {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.areebgillani.boost;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.impl.logging.Logger;
import io.vertx.core.impl.logging.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.areebgillani.boost;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.impl.logging.Logger;
import io.vertx.core.impl.logging.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,17 @@ 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<Verticle> serviceSupplier, String workerName, JsonObject workerConfig) throws Exception {
private void deployServices(JsonObject config, Supplier<Verticle> serviceSupplier, String workerName, JsonObject workerConfig) {
vertx.deployVerticle(serviceSupplier, new DeploymentOptions()
.setConfig(config)
.setWorkerPoolName(workerName)
.setWorkerPoolSize(workerConfig.getInteger("poolSize", 20))
.setInstances(workerConfig.getInteger("instance", 5))
.setThreadingModel(ThreadingModel.WORKER), res -> {
.setThreadingModel(switch (workerConfig.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.");
else
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/areebgillani/boost/Booster.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void scanControllers() throws Exception {
}
}

private void scanServices() throws Exception {
private void scanServices() {
Reflections reflections = new Reflections(basePackage);
Set<Class<?>> services = reflections.getTypesAnnotatedWith(Service.class);
Set<Class<?>> repos = reflections.getTypesAnnotatedWith(Repository.class);
Expand Down

0 comments on commit 70f84d6

Please sign in to comment.