From 90ec2c844356ac44a3990c95ba1426f33bb86611 Mon Sep 17 00:00:00 2001 From: Jhon Rondon Date: Wed, 22 Jun 2022 15:28:53 -0500 Subject: [PATCH 1/2] feat: Support to manage different queues for ili processes --- .gitignore | 2 + Dockerfile | 12 +++-- .../ili/services/rabbitmq/RabbitMQConfig.java | 54 +++++++++++++++++-- .../listerners/RabbitMQIliListener.java | 2 +- src/main/resources/application.yml | 5 +- 5 files changed, 67 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 549e00a..3c82003 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ build/ ### VS Code ### .vscode/ + +newrelic.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9ea6e61..e6ad566 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,23 @@ FROM openjdk:11 -ARG XMX=1024m +ARG XMX=4096m ARG PROFILE=production ARG CLOUD_CONFIG +ARG ILI_QUEUE +ARG NEW_RELIC_ENVIRONMENT ENV XMX=$XMX ENV PROFILE=$PROFILE ENV CLOUD_CONFIG=$CLOUD_CONFIG +ENV ILI_QUEUE=$ILI_QUEUE +ENV NEW_RELIC_ENVIRONMENT=$NEW_RELIC_ENVIRONMENT VOLUME /tmp -ADD ./target/st-microservice-ili-2.2.0.jar st-microservice-ili.jar +ADD ./target/st-microservice-ili-2.4.0.jar st-microservice-ili.jar +ADD ./target/newrelic.jar newrelic.jar +ADD ./newrelic.yml newrelic.yml EXPOSE 8080 -ENTRYPOINT java -Xmx$XMX -jar /st-microservice-ili.jar --spring.profiles.active=$PROFILE --spring.cloud.config.uri=$CLOUD_CONFIG \ No newline at end of file +ENTRYPOINT java -javaagent:/newrelic.jar -Dnewrelic.environment=$NEW_RELIC_ENVIRONMENT -Xmx$XMX -jar /st-microservice-ili.jar --spring.profiles.active=$PROFILE --spring.cloud.config.uri=$CLOUD_CONFIG --st.rabbitmq.queueInstance=$ILI_QUEUE \ No newline at end of file diff --git a/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/RabbitMQConfig.java b/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/RabbitMQConfig.java index 05ec539..dfc7489 100644 --- a/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/RabbitMQConfig.java +++ b/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/RabbitMQConfig.java @@ -250,10 +250,58 @@ public DirectExchange exchangeResultProcessSinicFilesName() { return new DirectExchange(queueResultProcessSinicFilesExchange); } + // queue ili sinic large + + @Value("${st.rabbitmq.queueIliSinicLarge.queue}") + public String queueIliSinicLargeName; + + @Value("${st.rabbitmq.queueIliSinicLarge.exchange}") + public String exchangeIliSinicLargeName; + + @Value("${st.rabbitmq.queueIliSinicLarge.routingkey}") + public String routingkeyIliSinicLargeName; + + @Bean + public Queue queueIliSinicLargeName() { + return new Queue(queueIliSinicLargeName, false); + } + + @Bean + public DirectExchange exchangeIliSinicLargeName() { + return new DirectExchange(exchangeIliSinicLargeName); + } + + @Bean + public Binding bindingIliSinicLargeName() { + return BindingBuilder.bind(queueIliSinicLargeName()).to(exchangeIliSinicLargeName()) + .with(routingkeyIliSinicLargeName); + } + + // queue ili sinic small + + @Value("${st.rabbitmq.queueIliSinicSmall.queue}") + public String queueIliSinicSmallName; + + @Value("${st.rabbitmq.queueIliSinicSmall.exchange}") + public String exchangeIliSinicSmallName; + + @Value("${st.rabbitmq.queueIliSinicSmall.routingkey}") + public String routingkeyIliSinicSmallName; + + @Bean + public Queue queueIliSinicSmallName() { + return new Queue(queueIliSinicSmallName, false); + } + + @Bean + public DirectExchange exchangeIliSinicSmallName() { + return new DirectExchange(exchangeIliSinicSmallName); + } + @Bean - public Binding bindingResultProcessSinicFilesName() { - return BindingBuilder.bind(queueResultProcessSinicFilesName()).to(exchangeResultProcessSinicFilesName()) - .with(queueResultProcessSinicFilesRoutingKey); + public Binding bindingIliSinicSmallName() { + return BindingBuilder.bind(queueIliSinicSmallName()).to(exchangeIliSinicSmallName()) + .with(routingkeyIliSinicSmallName); } // Setup diff --git a/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/listerners/RabbitMQIliListener.java b/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/listerners/RabbitMQIliListener.java index bdbf60a..2f6b95a 100644 --- a/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/listerners/RabbitMQIliListener.java +++ b/src/main/java/com/ai/st/microservice/ili/services/rabbitmq/listerners/RabbitMQIliListener.java @@ -70,7 +70,7 @@ public class RabbitMQIliListener { @Autowired private VersionBusiness versionBusiness; - @RabbitListener(queues = "${st.rabbitmq.queueIli.queue}", concurrency = "${st.rabbitmq.queueIli.concurrency}") + @RabbitListener(queues = "${st.rabbitmq.queueInstance}", concurrency = "1") public void iliProcess(IliProcessQueueDto data) { log.info("ili process started"); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7d889c3..95be1c9 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -27,4 +27,7 @@ server: iliProcesses: srs: "9377" - \ No newline at end of file + +st: + rabbitmq: + queueInstance: st.queue.ili \ No newline at end of file From 28f459f8b9ab266b3becc61b9eabd097464a6304 Mon Sep 17 00:00:00 2001 From: Jhon Rondon Date: Wed, 22 Jun 2022 15:36:09 -0500 Subject: [PATCH 2/2] chore: Set version --- Dockerfile | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6ad566..9437900 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ENV NEW_RELIC_ENVIRONMENT=$NEW_RELIC_ENVIRONMENT VOLUME /tmp -ADD ./target/st-microservice-ili-2.4.0.jar st-microservice-ili.jar +ADD ./target/st-microservice-ili-2.4.2.jar st-microservice-ili.jar ADD ./target/newrelic.jar newrelic.jar ADD ./newrelic.yml newrelic.yml diff --git a/pom.xml b/pom.xml index 3877b61..2215cab 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.ai.st.microservice.ili st-microservice-ili - 2.4.0 + 2.4.2 st-microservice-ili Microservice ILI