From 1c4b52d848da26a61adde0be6694ca4b56376a83 Mon Sep 17 00:00:00 2001 From: SravanThotakura05 <83568543+SravanThotakura05@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:15:53 +0530 Subject: [PATCH] addressed comments in PR #14 --- .../quarkiverse/solace/fault/SolaceErrorTopic.java | 2 +- .../fault/SolaceErrorTopicPublisherHandler.java | 4 ++-- .../io/quarkiverse/solace/i18n/SolaceLogging.java | 13 +++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopic.java b/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopic.java index 90077ea..ec1aaee 100644 --- a/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopic.java +++ b/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopic.java @@ -58,7 +58,7 @@ public CompletionStage handle(SolaceInboundMessage msg, Throwable reaso ackSupport.settle(msg.getMessage(), MessageAcknowledgementConfiguration.Outcome.ACCEPTED); }) .replaceWithVoid() - .onFailure().invoke(t -> SolaceLogging.log.unsuccessfulToTopic(errorTopic, channel, t.getMessage())) + .onFailure().invoke(t -> SolaceLogging.log.unsuccessfulToTopic(errorTopic, channel, t)) .emitOn(msg::runOnMessageContext) .subscribeAsCompletionStage(); } diff --git a/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopicPublisherHandler.java b/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopicPublisherHandler.java index 570abaf..c6fc0fa 100644 --- a/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopicPublisherHandler.java +++ b/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/fault/SolaceErrorTopicPublisherHandler.java @@ -22,6 +22,7 @@ public SolaceErrorTopicPublisherHandler(MessagingService solace) { this.solace = solace; publisher = solace.createPersistentMessagePublisherBuilder().build(); + publisher.setMessagePublishReceiptListener(this); publisher.start(); outboundErrorMessageMapper = new OutboundErrorMessageMapper(); } @@ -32,7 +33,6 @@ public Uni handle(SolaceInboundMessage message, OutboundMessage outboundMessage = outboundErrorMessageMapper.mapError(this.solace.messageBuilder(), message.getMessage(), dmqEligible, timeToLive); - publisher.setMessagePublishReceiptListener(this); // } return Uni.createFrom(). emitter(e -> { try { @@ -41,7 +41,7 @@ public Uni handle(SolaceInboundMessage message, } catch (Throwable t) { e.fail(t); } - }).onFailure().invoke(t -> SolaceLogging.log.publishException(errorTopic, t.getMessage())); + }).onFailure().invoke(t -> SolaceLogging.log.publishException(errorTopic, t)); } @Override diff --git a/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/i18n/SolaceLogging.java b/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/i18n/SolaceLogging.java index 564b782..843b5f6 100644 --- a/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/i18n/SolaceLogging.java +++ b/pubsub-plus-connector/src/main/java/io/quarkiverse/solace/i18n/SolaceLogging.java @@ -2,10 +2,7 @@ import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; -import org.jboss.logging.annotations.Once; +import org.jboss.logging.annotations.*; /** * Logging for Solace PubSub Connector @@ -30,12 +27,12 @@ public interface SolaceLogging extends BasicLogger { void messageSettled(String channel, String outcome, String reason); @LogMessage(level = Logger.Level.ERROR) - @Message(id = 55203, value = "Publishing error message to topic %s received from channel `%s` is unsuccessful, reason: %s") - void unsuccessfulToTopic(String topic, String channel, String reason); + @Message(id = 55203, value = "Publishing error message to topic %s received from channel `%s` is unsuccessful") + void unsuccessfulToTopic(String topic, String channel, @Cause Throwable cause); @LogMessage(level = Logger.Level.ERROR) - @Message(id = 55204, value = "A exception occurred when publishing to topic %s, reason: %s") - void publishException(String topic, String reason); + @Message(id = 55204, value = "A exception occurred when publishing to topic %s") + void publishException(String topic, @Cause Throwable cause); @LogMessage(level = Logger.Level.ERROR) @Message(id = 55205, value = "A exception occurred during shutdown %s")