Skip to content

Commit

Permalink
fix(commonjms): Update commons jms to 2.0.1 version and generated code (
Browse files Browse the repository at this point in the history
#434)

* fix(commonjms): Update commons jms to 2.0.1 version and generated code

* ci(check): disable dependency check because too slow
  • Loading branch information
juancgalvis authored Feb 8, 2024
1 parent d4906b8 commit a0a0175
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 77 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ jobs:
- name: Scan generated reactive project dependencies
if: steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json
run: ./gradlew build it
# run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json
- name: Sonar analysis for generated reactive project
if: github.event.pull_request.head.repo.fork == false && steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
Expand All @@ -90,7 +91,8 @@ jobs:
- name: Scan generated imperative project dependencies
if: steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json
run: ./gradlew build it
# run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json
- name: Sonar analysis for generated imperative project
if: github.event.pull_request.head.repo.fork == false && steps.changes.outputs.templates == 'true'
working-directory: ./build/toscan
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/co/com/bancolombia/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class Constants {
public static final String REACTIVE_COMMONS_MAPPER_VERSION = "0.1.0";
public static final String BLOCK_HOUND_VERSION = "1.0.8.RELEASE";
public static final String AWS_BOM_VERSION = "2.23.8";
public static final String COMMONS_JMS_VERSION = "1.4.1";
public static final String COMMONS_JMS_VERSION = "2.0.1";
public static final String GRAPHQL_KICKSTART_VERSION = "15.1.0";
public static final String ARCH_UNIT_VERSION = "1.2.1";
public static final String OKHTTP_VERSION = "4.12.0";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package {{package}}.mq.sender;

import co.com.bancolombia.commons.jms.api.MQMessageSenderSync;
import co.com.bancolombia.commons.jms.mq.EnableMQMessageSender;
import co.com.bancolombia.commons.jms.mq.EnableMQGateway;
{{#metrics}}
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Timer;
Expand All @@ -20,12 +20,9 @@ import java.util.concurrent.TimeUnit;
{{#lombok}}
@AllArgsConstructor
{{/lombok}}
@EnableMQMessageSender
//@EnableMQSelectorMessageListener // Enable it to retrieve a specific message by correlationId
@EnableMQGateway(scanBasePackages = "{{package}}")
public class SampleMQMessageSender /* implements SomeGateway */ {
private final MQMessageSenderSync sender;
// private final MQQueuesContainer container; // Inject it to reference a temporary queue
// private final MQMessageSelectorListenerSync listener; // Inject it to retrieve a specific message by correlationId
{{#metrics}}
private final Timer timer = Metrics.timer("mq_send_message", "operation", "my-operation"); // TODO: Change operation name
{{/metrics}}
Expand Down Expand Up @@ -55,15 +52,4 @@ public class SampleMQMessageSender /* implements SomeGateway */ {
});
{{/metrics}}
}

// Enable it to retrieve a specific message by correlationId
// public String getResult(String correlationId) {
// Message message = listener.getMessage(correlationId);
// return extractResponse(message);
// }
//
// private String extractResponse(Message message) {
// TextMessage textMessage = (TextMessage) message;
// return textMessage.getText();
// }
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
package {{package}}.mq.reqreply;

import co.com.bancolombia.commons.jms.api.MQRequestReply;
import co.com.bancolombia.commons.jms.mq.ReqReply;
import reactor.core.publisher.Mono;

import jakarta.jms.Message;

@ReqReply(requestQueue = "DEV.QUEUE.1") // TODO: Change the queue name, or use from properties like ${my.queue}
public interface ReqReplyGateway {
Mono<Message> requestReply(String message);
// You can use one of the next alternatives
// Mono<Message> requestReply(String message, Duration timeout);
//
// Mono<Message> requestReply(MQMessageCreator messageCreator);
//
// Mono<Message> requestReply(MQMessageCreator messageCreator, Duration timeout);
@ReqReply(requestQueue = "${commons.jms.output-queue}"/*replyQueue = "${commons.jms.input-queue}", queueType = FIXED*/) // TODO: Change the queue name, or use from properties like ${my.queue}
public interface ReqReplyGateway extends MQRequestReply {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package {{package}}.mq.sender;

import co.com.bancolombia.commons.jms.api.MQMessageSender;
import co.com.bancolombia.commons.jms.mq.EnableMQMessageSender;
import co.com.bancolombia.commons.jms.mq.EnableMQGateway;
{{#lombok}}
import lombok.AllArgsConstructor;
{{/lombok}}
Expand All @@ -14,12 +14,10 @@ import jakarta.jms.Message;
{{#lombok}}
@AllArgsConstructor
{{/lombok}}
@EnableMQMessageSender
//@EnableMQSelectorMessageListener // Enable it to retrieve a specific message by correlationId
@EnableMQGateway(scanBasePackages = "{{package}}")
public class SampleMQMessageSender /* implements SomeGateway */ {
private final MQMessageSender sender;
// private final MQQueuesContainer container; // Inject it to reference a queue
// private final MQMessageSelectorListener listener; // Inject it to retrieve a specific message by correlationId
{{^lombok}}

public MyMessageSender(MQMessageSender sender) {
Expand All @@ -39,20 +37,4 @@ public class SampleMQMessageSender /* implements SomeGateway */ {
.metrics();
{{/metrics}}
}

// Enable it to retrieve a specific message by correlationId
// public Mono<String> getResult(String correlationId) {
// return listener.getMessage(correlationId)
{{#metrics}}
// .name("mq_receive_message")
// .tag("operation", "my-operation") // TODO: Change operation name
// .metrics()
{{/metrics}}
// .map(this::extractResponse);
// }
//
// private String extractResponse(Message message) {
// TextMessage textMessage = (TextMessage) message;
// return textMessage.getText();
// }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package {{package}}.mq.reqreply;

import co.com.bancolombia.commons.jms.mq.EnableReqReply;
import co.com.bancolombia.commons.jms.mq.EnableMQGateway;
{{#lombok}}
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
Expand All @@ -15,7 +15,7 @@ import jakarta.jms.TextMessage;
{{#lombok}}
@AllArgsConstructor
{{/lombok}}
@EnableReqReply
@EnableMQGateway(scanBasePackages = "{{package}}")
public class SampleMQReqReply /* implements SomeGateway */ {
private final ReqReplyGateway sender;
{{^lombok}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,12 @@ public class SampleMQMessageListener {

{{/lombok}}
// For fixed queues
@MQListener
@MQListener("${commons.jms.input-queue}")
public void process(Message message) throws JMSException {
{{#metrics}}
timer.record(System.currentTimeMillis() - message.getJMSTimestamp(), TimeUnit.MILLISECONDS);
{{/metrics}}
String text = ((TextMessage) message).getText();
// useCase.sample(text);
}

// For an automatic generated temporary queue
// @MQListener(tempQueueAlias = "any-custom-value")
// public void processFromTemporaryQueue(Message message) throws JMSException {
{{#metrics}}
// timer.record(System.currentTimeMillis() - message.getJMSTimestamp(), TimeUnit.MILLISECONDS);
{{/metrics}}
// String text = ((TextMessage) message).getText();
// // useCase.sample(text);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class SampleMQMessageListener {

{{/lombok}}
// For fixed queues
@MQListener
@MQListener("${commons.jms.input-queue}")
public Mono<Void> process(Message message) throws JMSException {
{{#metrics}}
timer.record(System.currentTimeMillis() - message.getJMSTimestamp(), TimeUnit.MILLISECONDS);
Expand All @@ -44,15 +44,4 @@ public class SampleMQMessageListener {
// return useCase.sample(text);
return Mono.empty();
}

// For an automatic generated temporary queue
// @MQListener(tempQueueAlias = "any-custom-value")
// public Mono<Void> processFromTemporaryQueue(Message message) throws JMSException {
{{#metrics}}
// timer.record(System.currentTimeMillis() - message.getJMSTimestamp(), TimeUnit.MILLISECONDS);
{{/metrics}}
// String text = ((TextMessage) message).getText();
// // return useCase.sample(text);
// return Mono.empty();
// }
}
1 change: 0 additions & 1 deletion src/main/resources/structure/root/build.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ sonar {
property "sonar.projectKey", "bancolombia_scaffold-clean-architecture-generated-i"
{{/reactive}}
property "sonar.host.url", "https://sonarcloud.io/"
property "sonar.externalIssuesReportPaths", "build/reports/dependency-check-sonar.json"
{{/example}}
property "sonar.sourceEncoding", "UTF-8"
property "sonar.modules", "${modules.join(',')}"
Expand Down

0 comments on commit a0a0175

Please sign in to comment.