diff --git a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java index 9fee9626a..0ba7fd703 100644 --- a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java @@ -73,6 +73,7 @@ public class DataImportConsumerVerticle extends KafkaConsumerVerticle { DI_SRS_MARC_HOLDINGS_RECORD_NOT_MATCHED, DI_PENDING_ORDER_CREATED ); + private static final String BASE_PROPERTY = "DataImportConsumerVerticle"; @Override public void start(Promise startPromise) { @@ -99,4 +100,9 @@ protected Logger getLogger() { return LOGGER; } + @Override + protected String getBaseProperty() { + return BASE_PROPERTY; + } + } diff --git a/src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java b/src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java index fb1835463..2d4eb0c08 100644 --- a/src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java @@ -12,6 +12,7 @@ public class InstanceIngressConsumerVerticle extends KafkaConsumerVerticle { private static final String INSTANCE_INGRESS_TOPIC = "inventory.instance_ingress"; private static final Logger LOGGER = LogManager.getLogger(InstanceIngressConsumerVerticle.class); + private static final String BASE_PROPERTY = "InstanceIngressConsumerVerticle"; @Override public void start(Promise startPromise) { @@ -28,4 +29,9 @@ public void start(Promise startPromise) { protected Logger getLogger() { return LOGGER; } + + @Override + protected String getBaseProperty() { + return BASE_PROPERTY; + } } diff --git a/src/main/java/org/folio/inventory/Launcher.java b/src/main/java/org/folio/inventory/Launcher.java index 5eb03e397..f4251e0fa 100644 --- a/src/main/java/org/folio/inventory/Launcher.java +++ b/src/main/java/org/folio/inventory/Launcher.java @@ -108,7 +108,7 @@ private static void startConsumerVerticles(Map consumerVerticles CompletableFuture future6 = new CompletableFuture<>(); vertxAssistant.deployVerticle(DataImportConsumerVerticle.class.getName(), consumerVerticlesConfig, dataImportConsumerVerticleNumber, future1); - vertxAssistant.deployVerticle(MarcBibInstanceHridSetConsumerVerticle.class.getName(), + vertxAssistant.deployVerticle(MarcHridSetConsumerVerticle.class.getName(), consumerVerticlesConfig, instanceHridSetConsumerVerticleNumber, future2); vertxAssistant.deployVerticle(QuickMarcConsumerVerticle.class.getName(), consumerVerticlesConfig, quickMarcConsumerVerticleNumber, future3); diff --git a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java index 34a25e742..80cd3454a 100644 --- a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java @@ -12,6 +12,7 @@ public class MarcBibUpdateConsumerVerticle extends KafkaConsumerVerticle { private static final Logger LOGGER = LogManager.getLogger(MarcBibUpdateConsumerVerticle.class); private static final String SRS_MARC_BIB_EVENT = "srs.marc-bib"; + private static final String BASE_PROPERTY = "MarcBibUpdateConsumer"; @Override public void start(Promise startPromise) { @@ -32,4 +33,9 @@ protected Logger getLogger() { return LOGGER; } + @Override + protected String getBaseProperty() { + return BASE_PROPERTY; + } + } diff --git a/src/main/java/org/folio/inventory/MarcBibInstanceHridSetConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java similarity index 88% rename from src/main/java/org/folio/inventory/MarcBibInstanceHridSetConsumerVerticle.java rename to src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java index 9150836eb..63c31f49d 100644 --- a/src/main/java/org/folio/inventory/MarcBibInstanceHridSetConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java @@ -15,9 +15,10 @@ import org.folio.inventory.services.HoldingsCollectionService; import org.folio.inventory.support.KafkaConsumerVerticle; -public class MarcBibInstanceHridSetConsumerVerticle extends KafkaConsumerVerticle { +public class MarcHridSetConsumerVerticle extends KafkaConsumerVerticle { - private static final Logger LOGGER = LogManager.getLogger(MarcBibInstanceHridSetConsumerVerticle.class); + private static final Logger LOGGER = LogManager.getLogger(MarcHridSetConsumerVerticle.class); + private static final String BASE_PROPERTY = "MarcBibInstanceHridSetConsumer"; @Override public void start(Promise startPromise) { @@ -44,4 +45,9 @@ protected Logger getLogger() { return LOGGER; } + @Override + protected String getBaseProperty() { + return BASE_PROPERTY; + } + } diff --git a/src/main/java/org/folio/inventory/QuickMarcConsumerVerticle.java b/src/main/java/org/folio/inventory/QuickMarcConsumerVerticle.java index b2b2a92ad..471eeefef 100644 --- a/src/main/java/org/folio/inventory/QuickMarcConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/QuickMarcConsumerVerticle.java @@ -14,6 +14,7 @@ public class QuickMarcConsumerVerticle extends KafkaConsumerVerticle { private static final Logger LOGGER = LogManager.getLogger(QuickMarcConsumerVerticle.class); + private static final String BASE_PROPERTY = "QuickMarcConsumerVerticle"; @Override public void start(Promise startPromise) { @@ -35,4 +36,9 @@ protected Logger getLogger() { return LOGGER; } + @Override + protected String getBaseProperty() { + return BASE_PROPERTY; + } + } diff --git a/src/main/java/org/folio/inventory/support/KafkaConsumerVerticle.java b/src/main/java/org/folio/inventory/support/KafkaConsumerVerticle.java index dad4234a5..2b3e4174e 100644 --- a/src/main/java/org/folio/inventory/support/KafkaConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/support/KafkaConsumerVerticle.java @@ -16,7 +16,6 @@ import io.vertx.core.AbstractVerticle; import io.vertx.core.Promise; -import io.vertx.core.Verticle; import io.vertx.core.http.HttpClient; import io.vertx.core.json.JsonObject; import java.util.ArrayList; @@ -157,9 +156,9 @@ private int getLoadLimit() { } private int getConsumerProperty(String nameTemplate, String defaultValue) { - var consumerClassName = getClass().getSimpleName(); - var cleanConsumerName = consumerClassName.substring(0, consumerClassName.indexOf(Verticle.class.getSimpleName())); - return parseInt(getProperty(format(nameTemplate, cleanConsumerName), defaultValue)); + return parseInt(getProperty(format(nameTemplate, getBaseProperty()), defaultValue)); } + protected abstract String getBaseProperty(); + } diff --git a/src/test/java/org/folio/inventory/dataimport/consumers/MarcBibInstanceHridSetConsumerVerticleTest.java b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHridSetConsumerVerticleTest.java similarity index 90% rename from src/test/java/org/folio/inventory/dataimport/consumers/MarcBibInstanceHridSetConsumerVerticleTest.java rename to src/test/java/org/folio/inventory/dataimport/consumers/MarcHridSetConsumerVerticleTest.java index 519035bfc..61843652f 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/MarcBibInstanceHridSetConsumerVerticleTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHridSetConsumerVerticleTest.java @@ -8,7 +8,7 @@ import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import net.mguenther.kafka.junit.EmbeddedKafkaCluster; -import org.folio.inventory.MarcBibInstanceHridSetConsumerVerticle; +import org.folio.inventory.MarcHridSetConsumerVerticle; import org.junit.AfterClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,7 +22,7 @@ import static org.folio.inventory.dataimport.util.KafkaConfigConstants.KAFKA_REPLICATION_FACTOR; @RunWith(VertxUnitRunner.class) -public class MarcBibInstanceHridSetConsumerVerticleTest { +public class MarcHridSetConsumerVerticleTest { private static final String TENANT_ID = "diku"; private static final String KAFKA_ENV_NAME = "test-env"; @@ -46,7 +46,7 @@ public void shouldDeployVerticle(TestContext context) { .setWorker(true); Promise promise = Promise.promise(); - vertx.deployVerticle(MarcBibInstanceHridSetConsumerVerticle.class.getName(), options, promise); + vertx.deployVerticle(MarcHridSetConsumerVerticle.class.getName(), options, promise); promise.future().onComplete(ar -> { context.assertTrue(ar.succeeded());