From cbf8eb15cca1b048adc930dcca0cbd2b45af5c96 Mon Sep 17 00:00:00 2001 From: Christian Gendreau Date: Thu, 18 Jan 2024 14:02:34 -0500 Subject: [PATCH 1/5] Prepare next development version --- dina-base-api/pom.xml | 4 ++-- dina-messaging/pom.xml | 2 +- dina-search/pom.xml | 2 +- dina-test-support/pom.xml | 2 +- dina-workbook/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dina-base-api/pom.xml b/dina-base-api/pom.xml index c41b8a337..aafad9448 100644 --- a/dina-base-api/pom.xml +++ b/dina-base-api/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.114 + 0.115-SNAPSHOT dina-base-api @@ -144,7 +144,7 @@ io.github.aafc-bicoe dina-test-support - 0.114 + 0.115-SNAPSHOT test diff --git a/dina-messaging/pom.xml b/dina-messaging/pom.xml index 8dee4c950..50fc835f2 100644 --- a/dina-messaging/pom.xml +++ b/dina-messaging/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.114 + 0.115-SNAPSHOT dina-messaging diff --git a/dina-search/pom.xml b/dina-search/pom.xml index 05879594a..a76654514 100644 --- a/dina-search/pom.xml +++ b/dina-search/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.114 + 0.115-SNAPSHOT dina-search diff --git a/dina-test-support/pom.xml b/dina-test-support/pom.xml index cfc21c22e..0fe1b11c6 100644 --- a/dina-test-support/pom.xml +++ b/dina-test-support/pom.xml @@ -9,7 +9,7 @@ io.github.aafc-bicoe dina-base-parent - 0.114 + 0.115-SNAPSHOT dina-test-support diff --git a/dina-workbook/pom.xml b/dina-workbook/pom.xml index e3c7d969a..ad2ca50d5 100644 --- a/dina-workbook/pom.xml +++ b/dina-workbook/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.114 + 0.115-SNAPSHOT dina-workbook diff --git a/pom.xml b/pom.xml index 280932980..eb5cd44ca 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.aafc-bicoe dina-base-parent - 0.114 + 0.115-SNAPSHOT pom From 2d60ccf694247644bd4a60ea522f71d436a2017e Mon Sep 17 00:00:00 2001 From: Christian Gendreau Date: Fri, 19 Jan 2024 14:39:39 -0500 Subject: [PATCH 2/5] 32759 Add messages to dina-messaging Added DocumentOperationNotification classes --- .../DocumentOperationNotification.java | 52 +++++++++++++++++++ .../message/DocumentOperationType.java | 11 ++++ 2 files changed, 63 insertions(+) create mode 100644 dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationNotification.java create mode 100644 dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationType.java diff --git a/dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationNotification.java b/dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationNotification.java new file mode 100644 index 000000000..09777a48d --- /dev/null +++ b/dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationNotification.java @@ -0,0 +1,52 @@ +package ca.gc.aafc.dina.messaging.message; + +import lombok.Builder; +import lombok.Getter; + +import ca.gc.aafc.dina.messaging.DinaMessage; + +/** + * Class representing a message to indicate a change on a document (JSON document) + * + */ +@Getter +public class DocumentOperationNotification implements DinaMessage { + + public static final String NOT_DEFINED = "Not-Defined"; + + private final boolean dryRun; + private final String documentId; + private final String documentType; + private final DocumentOperationType operationType; + + public DocumentOperationNotification() { + this.dryRun = false; + this.documentId = NOT_DEFINED; + this.documentType = NOT_DEFINED; + this.operationType = DocumentOperationType.NOT_DEFINED; + } + + /** + * Document operation notification. + * + * @param dryRun flag denoting if the operation/processing associated with the message should be + * bypassed. + * @param documentType DINA document type (metadata, person, organization, etc...) + * @param documentId The document UUID + * @param operationType Operation type as defined by the enumerated type. + */ + @Builder + public DocumentOperationNotification(boolean dryRun, String documentType, String documentId, + DocumentOperationType operationType) { + this.dryRun = dryRun; + this.documentId = documentId; + this.documentType = documentType; + this.operationType = operationType; + } + + @Override + public String toString() { + return "DocumentOperationNotification [operationType=" + operationType + ", documentId=" + documentId + + ", documentType=" + documentType + ", dryRun=" + dryRun + "]"; + } +} diff --git a/dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationType.java b/dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationType.java new file mode 100644 index 000000000..b5b335a08 --- /dev/null +++ b/dina-messaging/src/main/java/ca/gc/aafc/dina/messaging/message/DocumentOperationType.java @@ -0,0 +1,11 @@ +package ca.gc.aafc.dina.messaging.message; + +/** + * Enumerated type describing the type of operations that can be done to document. + */ +public enum DocumentOperationType { + NOT_DEFINED, + ADD, + UPDATE, + DELETE; +} From ff3ed9c4c83cd88b26766ef15cc0e41e3d4207b1 Mon Sep 17 00:00:00 2001 From: Christian Gendreau Date: Wed, 24 Jan 2024 15:01:44 -0500 Subject: [PATCH 3/5] 32780 Update search-messaging library Updated search-messaging and related test --- dina-base-api/pom.xml | 2 +- .../dina/service/MessageProducingServiceTest.java | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dina-base-api/pom.xml b/dina-base-api/pom.xml index aafad9448..b0721782e 100644 --- a/dina-base-api/pom.xml +++ b/dina-base-api/pom.xml @@ -26,7 +26,7 @@ 0.8.8 6.13.0 2.2.2 - 0.20 + 0.29 3.6.1 42.4.3 1.15.3 diff --git a/dina-base-api/src/test/java/ca/gc/aafc/dina/service/MessageProducingServiceTest.java b/dina-base-api/src/test/java/ca/gc/aafc/dina/service/MessageProducingServiceTest.java index 434b69f03..9188017f5 100644 --- a/dina-base-api/src/test/java/ca/gc/aafc/dina/service/MessageProducingServiceTest.java +++ b/dina-base-api/src/test/java/ca/gc/aafc/dina/service/MessageProducingServiceTest.java @@ -45,14 +45,11 @@ @SpringBootTest(classes = {TestDinaBaseApp.class, MessageProducingServiceTest.TestConfig.class}, properties = { - "messaging.isProducer=true", + "dina.messaging.isProducer=true", "rabbitmq.queue=que", - "rabbitmq.exchange=exchange", - "rabbitmq.routingkey=routingkey", "rabbitmq.username=guest", "rabbitmq.password=guest", - "rabbitmq.host=localhost", - "rabbitmq.port=49198" + "rabbitmq.host=localhost" }) @ContextConfiguration(initializers = { PostgresTestContainerInitializer.class }) @DirtiesContext //it's an expensive test and we won't reuse the context @@ -197,11 +194,10 @@ public static class Listener { @RabbitListener(bindings = @QueueBinding( value = @Queue(value = "que"), - exchange = @Exchange(value = "exchange", ignoreDeclarationExceptions = "true"), - key = "routingkey"), + exchange = @Exchange(value = "que", ignoreDeclarationExceptions = "true")), containerFactory = "rabbitListenerContainerFactory" ) - public void processOrder(String data) { + public void processMessage(String data) { messages.clear(); messages.add(data); latch.countDown(); From d9a5253ab7b40def1c600637731c3684bdabbedd Mon Sep 17 00:00:00 2001 From: Christian Gendreau Date: Wed, 24 Jan 2024 15:47:01 -0500 Subject: [PATCH 4/5] 32779 Add better default for ElasticSearch port Added default port for ElasticSearchConfig --- .../ca/gc/aafc/dina/search/config/ElasticSearchConfig.java | 5 ++++- .../gc/aafc/dina/search/config/ElasticSearchProperties.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchConfig.java b/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchConfig.java index 06b94b3d0..96ad5454c 100644 --- a/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchConfig.java +++ b/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchConfig.java @@ -13,10 +13,13 @@ @Configuration public class ElasticSearchConfig { + public static final int DEFAULT_PORT = 9200; + @Bean public ElasticsearchClient provideClient(ElasticSearchProperties esProps) { + int port = esProps.getPort() <= 0 ? DEFAULT_PORT : esProps.getPort(); RestClient restClient = RestClient.builder( - new HttpHost(esProps.getHost(), esProps.getPort()) + new HttpHost(esProps.getHost(), port) ).build(); // Create the elastic search transport using Jackson and the low level rest client. diff --git a/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchProperties.java b/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchProperties.java index 82b7b8ae3..376db02f8 100644 --- a/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchProperties.java +++ b/dina-search/src/main/java/ca/gc/aafc/dina/search/config/ElasticSearchProperties.java @@ -21,6 +21,9 @@ public class ElasticSearchProperties { @NotBlank private String host; + /** + * If not provided the value will be 0 + */ private int port; } From 55b39e2d67eeb0916997653300af024a2a7c05f5 Mon Sep 17 00:00:00 2001 From: Christian Gendreau Date: Thu, 25 Jan 2024 11:26:22 -0500 Subject: [PATCH 5/5] Prepare 0.115 release --- dina-base-api/pom.xml | 4 ++-- dina-messaging/pom.xml | 2 +- dina-search/pom.xml | 2 +- dina-test-support/pom.xml | 2 +- dina-workbook/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dina-base-api/pom.xml b/dina-base-api/pom.xml index b0721782e..7b96fa388 100644 --- a/dina-base-api/pom.xml +++ b/dina-base-api/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.115-SNAPSHOT + 0.115 dina-base-api @@ -144,7 +144,7 @@ io.github.aafc-bicoe dina-test-support - 0.115-SNAPSHOT + 0.115 test diff --git a/dina-messaging/pom.xml b/dina-messaging/pom.xml index 50fc835f2..5d41cc9c1 100644 --- a/dina-messaging/pom.xml +++ b/dina-messaging/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.115-SNAPSHOT + 0.115 dina-messaging diff --git a/dina-search/pom.xml b/dina-search/pom.xml index a76654514..2eea9dbf0 100644 --- a/dina-search/pom.xml +++ b/dina-search/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.115-SNAPSHOT + 0.115 dina-search diff --git a/dina-test-support/pom.xml b/dina-test-support/pom.xml index 0fe1b11c6..c48975da9 100644 --- a/dina-test-support/pom.xml +++ b/dina-test-support/pom.xml @@ -9,7 +9,7 @@ io.github.aafc-bicoe dina-base-parent - 0.115-SNAPSHOT + 0.115 dina-test-support diff --git a/dina-workbook/pom.xml b/dina-workbook/pom.xml index ad2ca50d5..2ba65c57b 100644 --- a/dina-workbook/pom.xml +++ b/dina-workbook/pom.xml @@ -8,7 +8,7 @@ io.github.aafc-bicoe dina-base-parent - 0.115-SNAPSHOT + 0.115 dina-workbook diff --git a/pom.xml b/pom.xml index eb5cd44ca..7bc434c5e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.aafc-bicoe dina-base-parent - 0.115-SNAPSHOT + 0.115 pom