Skip to content

Commit

Permalink
addressed comments in PR #14
Browse files Browse the repository at this point in the history
  • Loading branch information
SravanThotakura05 committed Jan 4, 2024
1 parent 3b52eea commit 1c4b52d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public CompletionStage<Void> 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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public SolaceErrorTopicPublisherHandler(MessagingService solace) {
this.solace = solace;

publisher = solace.createPersistentMessagePublisherBuilder().build();
publisher.setMessagePublishReceiptListener(this);
publisher.start();
outboundErrorMessageMapper = new OutboundErrorMessageMapper();
}
Expand All @@ -32,7 +33,6 @@ public Uni<PublishReceipt> handle(SolaceInboundMessage<?> message,
OutboundMessage outboundMessage = outboundErrorMessageMapper.mapError(this.solace.messageBuilder(),
message.getMessage(),
dmqEligible, timeToLive);
publisher.setMessagePublishReceiptListener(this);
// }
return Uni.createFrom().<PublishReceipt> emitter(e -> {
try {
Expand All @@ -41,7 +41,7 @@ public Uni<PublishReceipt> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit 1c4b52d

Please sign in to comment.