Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Jan 25, 2024
2 parents d0926e2 + 55b39e2 commit 5cdc9d5
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 17 deletions.
6 changes: 3 additions & 3 deletions dina-base-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-base-parent</artifactId>
<version>0.114</version>
<version>0.115</version>
</parent>

<artifactId>dina-base-api</artifactId>
Expand All @@ -26,7 +26,7 @@
<jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
<javers.version>6.13.0</javers.version>
<mybatis.version>2.2.2</mybatis.version>
<aafc.search.messaging.version>0.20</aafc.search.messaging.version>
<aafc.search.messaging.version>0.29</aafc.search.messaging.version>
<hypersistence-utils-hibernate-55.version>3.6.1</hypersistence-utils-hibernate-55.version>
<postgresql.version>42.4.3</postgresql.version>
<jsoup.version>1.15.3</jsoup.version>
Expand Down Expand Up @@ -144,7 +144,7 @@
<dependency>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-test-support</artifactId>
<version>0.114</version>
<version>0.115</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion dina-messaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-base-parent</artifactId>
<version>0.114</version>
<version>0.115</version>
</parent>

<artifactId>dina-messaging</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 + "]";
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion dina-search/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-base-parent</artifactId>
<version>0.114</version>
<version>0.115</version>
</parent>

<artifactId>dina-search</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class ElasticSearchProperties {
@NotBlank
private String host;

/**
* If not provided the value will be 0
*/
private int port;

}
2 changes: 1 addition & 1 deletion dina-test-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-base-parent</artifactId>
<version>0.114</version>
<version>0.115</version>
</parent>

<artifactId>dina-test-support</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion dina-workbook/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-base-parent</artifactId>
<version>0.114</version>
<version>0.115</version>
</parent>

<artifactId>dina-workbook</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-base-parent</artifactId>
<version>0.114</version>
<version>0.115</version>

<packaging>pom</packaging>

Expand Down

0 comments on commit 5cdc9d5

Please sign in to comment.