From 537cd3ba0692f4ccb817cb2113ebb1c43ea8b142 Mon Sep 17 00:00:00 2001 From: SravanThotakura05 <83568543+SravanThotakura05@users.noreply.github.com> Date: Mon, 29 Jan 2024 21:15:30 +0530 Subject: [PATCH] Added getAck and getNack methods in SolaceIncomingChannel --- .../messaging/incoming/SolaceInboundMessage.java | 12 ++++++++++++ .../com/solace/quarkus/samples/HelloConsumer.java | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pubsub-plus-connector/src/main/java/com/solace/quarkus/messaging/incoming/SolaceInboundMessage.java b/pubsub-plus-connector/src/main/java/com/solace/quarkus/messaging/incoming/SolaceInboundMessage.java index 646ce2c..1bb277e 100644 --- a/pubsub-plus-connector/src/main/java/com/solace/quarkus/messaging/incoming/SolaceInboundMessage.java +++ b/pubsub-plus-connector/src/main/java/com/solace/quarkus/messaging/incoming/SolaceInboundMessage.java @@ -4,6 +4,8 @@ import java.util.concurrent.CompletionStage; import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; import org.eclipse.microprofile.reactive.messaging.Metadata; @@ -82,6 +84,16 @@ public Metadata getMetadata() { return metadata; } + @Override + public Supplier> getAck() { + return this::ack; + } + + @Override + public Function> getNack() { + return this::nack; + } + @Override public CompletionStage ack() { this.unacknowledgedMessageTracker.decrement(); diff --git a/samples/hello-connector-solace/src/main/java/com/solace/quarkus/samples/HelloConsumer.java b/samples/hello-connector-solace/src/main/java/com/solace/quarkus/samples/HelloConsumer.java index 745affc..a6b7675 100644 --- a/samples/hello-connector-solace/src/main/java/com/solace/quarkus/samples/HelloConsumer.java +++ b/samples/hello-connector-solace/src/main/java/com/solace/quarkus/samples/HelloConsumer.java @@ -59,7 +59,7 @@ Message consumeAndPublishToDynamicTopic(SolaceInboundMessage p) { .setApplicationMessageId("test") .setDynamicDestination("hello/foobar/" + p.getMessage().getApplicationMessageId()) .createPubSubOutboundMetadata(); - return p.addMetadata(outboundMetadata).withAck(() -> p.ack()); + return p.addMetadata(outboundMetadata); } }