From 07d83c8c1f08c55780d88491de2aa708dcd176b7 Mon Sep 17 00:00:00 2001 From: pbobylev Date: Wed, 24 Apr 2024 15:17:52 +0500 Subject: [PATCH] MODINV-986: instance_ingest -> instance_ingress --- ....java => InstanceIngressConsumerVerticle.java} | 14 +++++++------- src/main/java/org/folio/inventory/Launcher.java | 15 ++++++++------- ...dler.java => InstanceIngressEventHandler.java} | 7 ++++--- 3 files changed, 19 insertions(+), 17 deletions(-) rename src/main/java/org/folio/inventory/{InstanceIngestConsumerVerticle.java => InstanceIngressConsumerVerticle.java} (55%) rename src/main/java/org/folio/inventory/handler/{InstanceIngestEventHandler.java => InstanceIngressEventHandler.java} (68%) diff --git a/src/main/java/org/folio/inventory/InstanceIngestConsumerVerticle.java b/src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java similarity index 55% rename from src/main/java/org/folio/inventory/InstanceIngestConsumerVerticle.java rename to src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java index 96bf1e24f..b3aec2fc4 100644 --- a/src/main/java/org/folio/inventory/InstanceIngestConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/InstanceIngressConsumerVerticle.java @@ -5,21 +5,21 @@ import io.vertx.core.Promise; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.folio.inventory.handler.InstanceIngestEventHandler; +import org.folio.inventory.handler.InstanceIngressEventHandler; import org.folio.inventory.support.KafkaConsumerVerticle; -public class InstanceIngestConsumerVerticle extends KafkaConsumerVerticle { +public class InstanceIngressConsumerVerticle extends KafkaConsumerVerticle { - private static final String INSTANCE_INGEST_TOPIC = "inventory.instance_ingest"; - private static final Logger LOGGER = LogManager.getLogger(InstanceIngestConsumerVerticle.class); + private static final String INSTANCE_INGRESS_TOPIC = "inventory.instance_ingress"; + private static final Logger LOGGER = LogManager.getLogger(InstanceIngressConsumerVerticle.class); @Override public void start(Promise startPromise) { - var instanceIngestEventHandler = new InstanceIngestEventHandler(); + var instanceIngressEventHandler = new InstanceIngressEventHandler(); - var consumerWrapper = createConsumer(INSTANCE_INGEST_TOPIC); + var consumerWrapper = createConsumer(INSTANCE_INGRESS_TOPIC); - consumerWrapper.start(instanceIngestEventHandler, constructModuleName()) + consumerWrapper.start(instanceIngressEventHandler, constructModuleName()) .onFailure(startPromise::fail) .onSuccess(ar -> startPromise.complete()); } diff --git a/src/main/java/org/folio/inventory/Launcher.java b/src/main/java/org/folio/inventory/Launcher.java index 3cbbfba66..fb514010b 100644 --- a/src/main/java/org/folio/inventory/Launcher.java +++ b/src/main/java/org/folio/inventory/Launcher.java @@ -25,7 +25,7 @@ public class Launcher { private static final String QUICK_MARC_CONSUMER_VERTICLE_INSTANCES_NUMBER_CONFIG = "inventory.kafka.QuickMarcConsumerVerticle.instancesNumber"; private static final String MARC_BIB_UPDATE_CONSUMER_VERTICLE_INSTANCES_NUMBER_CONFIG = "inventory.kafka.MarcBibUpdateConsumerVerticle.instancesNumber"; private static final String CONSORTIUM_INSTANCE_SHARING_CONSUMER_VERTICLE_NUMBER_CONFIG = "inventory.kafka.ConsortiumInstanceSharingConsumerVerticle.instancesNumber"; - private static final String INSTANCE_INGEST_VERTICLE_NUMBER_CONFIG = "inventory.kafka.InstanceIngestConsumerVerticle.instancesNumber"; + private static final String INSTANCE_INGRESS_VERTICLE_NUMBER_CONFIG = "inventory.kafka.InstanceIngressConsumerVerticle.instancesNumber"; private static final VertxAssistant vertxAssistant = new VertxAssistant(); private static String inventoryModuleDeploymentId; @@ -34,7 +34,7 @@ public class Launcher { private static String quickMarcConsumerVerticleDeploymentId; private static String marcBibUpdateConsumerVerticleDeploymentId; private static String consortiumInstanceSharingVerticleDeploymentId; - private static String instanceIngestConsumerVerticleDeploymentId; + private static String instanceIngressConsumerVerticleDeploymentId; public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException { @@ -98,7 +98,7 @@ private static void startConsumerVerticles(Map consumerVerticles int quickMarcConsumerVerticleNumber = Integer.parseInt(System.getenv().getOrDefault(QUICK_MARC_CONSUMER_VERTICLE_INSTANCES_NUMBER_CONFIG, "1")); int marcBibUpdateConsumerVerticleNumber = Integer.parseInt(System.getenv().getOrDefault(MARC_BIB_UPDATE_CONSUMER_VERTICLE_INSTANCES_NUMBER_CONFIG, "3")); int consortiumInstanceSharingVerticleNumber = Integer.parseInt(System.getenv().getOrDefault(CONSORTIUM_INSTANCE_SHARING_CONSUMER_VERTICLE_NUMBER_CONFIG, "3")); - int instanceIngestConsumerVerticleNumber = Integer.parseInt(System.getenv().getOrDefault(INSTANCE_INGEST_VERTICLE_NUMBER_CONFIG, "3")); + int instanceIngressConsumerVerticleNumber = Integer.parseInt(System.getenv().getOrDefault(INSTANCE_INGRESS_VERTICLE_NUMBER_CONFIG, "3")); CompletableFuture future1 = new CompletableFuture<>(); CompletableFuture future2 = new CompletableFuture<>(); @@ -116,15 +116,15 @@ private static void startConsumerVerticles(Map consumerVerticles consumerVerticlesConfig, marcBibUpdateConsumerVerticleNumber, future4); vertxAssistant.deployVerticle(ConsortiumInstanceSharingConsumerVerticle.class.getName(), consumerVerticlesConfig, consortiumInstanceSharingVerticleNumber, future5); - vertxAssistant.deployVerticle(InstanceIngestConsumerVerticle.class.getName(), - consumerVerticlesConfig, instanceIngestConsumerVerticleNumber, future6); + vertxAssistant.deployVerticle(InstanceIngressConsumerVerticle.class.getName(), + consumerVerticlesConfig, instanceIngressConsumerVerticleNumber, future6); consumerVerticleDeploymentId = future1.get(20, TimeUnit.SECONDS); marcInstHridSetConsumerVerticleDeploymentId = future2.get(20, TimeUnit.SECONDS); quickMarcConsumerVerticleDeploymentId = future3.get(20, TimeUnit.SECONDS); marcBibUpdateConsumerVerticleDeploymentId = future4.get(20, TimeUnit.SECONDS); consortiumInstanceSharingVerticleDeploymentId = future5.get(20, TimeUnit.SECONDS); - instanceIngestConsumerVerticleDeploymentId = future6.get(20, TimeUnit.SECONDS); + instanceIngressConsumerVerticleDeploymentId = future6.get(20, TimeUnit.SECONDS); } private static void stop() { @@ -140,7 +140,8 @@ private static void stop() { .thenCompose(v -> vertxAssistant.undeployVerticle(quickMarcConsumerVerticleDeploymentId)) .thenCompose(v -> vertxAssistant.undeployVerticle(marcBibUpdateConsumerVerticleDeploymentId)) .thenCompose(v -> vertxAssistant.undeployVerticle(consortiumInstanceSharingVerticleDeploymentId)) - .thenCompose(v -> vertxAssistant.undeployVerticle(instanceIngestConsumerVerticleDeploymentId)) + .thenCompose(v -> vertxAssistant.undeployVerticle( + instanceIngressConsumerVerticleDeploymentId)) .thenAccept(v -> vertxAssistant.stop(stopped)); stopped.thenAccept(v -> log.info("Server Stopped")); diff --git a/src/main/java/org/folio/inventory/handler/InstanceIngestEventHandler.java b/src/main/java/org/folio/inventory/handler/InstanceIngressEventHandler.java similarity index 68% rename from src/main/java/org/folio/inventory/handler/InstanceIngestEventHandler.java rename to src/main/java/org/folio/inventory/handler/InstanceIngressEventHandler.java index 41cbed9b2..0074c254a 100644 --- a/src/main/java/org/folio/inventory/handler/InstanceIngestEventHandler.java +++ b/src/main/java/org/folio/inventory/handler/InstanceIngressEventHandler.java @@ -6,15 +6,16 @@ import org.apache.logging.log4j.Logger; import org.folio.kafka.AsyncRecordHandler; -public class InstanceIngestEventHandler implements AsyncRecordHandler { +public class InstanceIngressEventHandler implements AsyncRecordHandler { - private static final Logger LOGGER = LogManager.getLogger(InstanceIngestEventHandler.class); + private static final Logger LOGGER = LogManager.getLogger( + InstanceIngressEventHandler.class); @Override public Future handle(KafkaConsumerRecord kafkaConsumerRecord) { // to extract and re-use common logic from CreateInstanceEventHandler // 1. Change event; 2. Re-use all except: source type to be changed to BIBFRAME, DI event not to be sent - LOGGER.info("to be replaced with actual code in Step 2 of MODINV-986"); + return null; }