Skip to content

Commit

Permalink
Merge pull request #2446 from ozangunalp/improve_backwards_compatibil…
Browse files Browse the repository at this point in the history
…ity_message_refacto

Improve backwards compatibility of new Message composition
  • Loading branch information
ozangunalp authored Jan 8, 2024
2 parents ba6904b + b43f780 commit 77a0ded
Show file tree
Hide file tree
Showing 3 changed files with 389 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ private static BiFunction<Throwable, Metadata, CompletionStage<Void>> validateNa

private static Function<Metadata, CompletionStage<Void>> wrapAck(Message<?> message) {
var ackM = message.getAckWithMetadata();
return ackM != EMPTY_ACK ? ackM : validateAck(message.getAck());
return ackM != null ? ackM : validateAck(message.getAck());
}

private static BiFunction<Throwable, Metadata, CompletionStage<Void>> wrapNack(Message<?> message) {
var nackM = message.getNackWithMetadata();
return nackM != EMPTY_NACK ? nackM : validateNack(message.getNack());
return nackM != null ? nackM : validateNack(message.getNack());
}

private static <T> Message<T> newMessage(T payload, Metadata metadata) {
Expand Down Expand Up @@ -502,7 +502,7 @@ default Supplier<CompletionStage<Void>> getAck() {
*/
@Experimental("metadata propagation is a SmallRye-specific feature")
default Function<Metadata, CompletionStage<Void>> getAckWithMetadata() {
return EMPTY_ACK;
return null;
}

/**
Expand All @@ -517,7 +517,7 @@ default Function<Throwable, CompletionStage<Void>> getNack() {
*/
@Experimental("metadata propagation is a SmallRye-specific feature")
default BiFunction<Throwable, Metadata, CompletionStage<Void>> getNackWithMetadata() {
return EMPTY_NACK;
return null;
}

/**
Expand Down
Loading

0 comments on commit 77a0ded

Please sign in to comment.