Skip to content

Commit

Permalink
6374 Fix RC in JMS error test (helidon-io#6376)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkec authored Mar 7, 2023
1 parent 166b9da commit a6130ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,19 @@ public CompletionStage<Void> channel31(Message<String> msg) {
@ApplicationScoped
public static class ChannelError extends AbstractSampleBean {
@Incoming("test-channel-error")
@Acknowledgment(Acknowledgment.Strategy.MANUAL)
public CompletionStage<Void> error(Message<String> msg) {
try {
LOGGER.fine(() -> String.format("Received possible error %s", msg.getPayload()));
consumed().add(Integer.toString(Integer.parseInt(msg.getPayload())));
} finally {
msg.ack().whenComplete((a, b) -> countDown("error()"));
}
return CompletableFuture.completedFuture(null);
@Outgoing("test-channel-error-2")
@Acknowledgment(Acknowledgment.Strategy.POST_PROCESSING)
public String error(String msg) {
LOGGER.fine(() -> String.format("Received possible error %s", msg));
consumed().add(Integer.toString(Integer.parseInt(msg)));
return msg;
}

@Incoming("test-channel-error-2")
public SubscriberBuilder<String, Void> consume() {
return ReactiveStreams.<String>builder()
.onError(t -> countDown("error()"))
.ignore();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void error() {
AbstractSampleBean bean = CDI.current().select(AbstractSampleBean.ChannelError.class).get();
// This is correctly processed
List<String> testData = Collections.singletonList("10");
produceAndCheck(bean, testData, TEST_TOPIC_ERROR, testData);
produce(TEST_TOPIC_ERROR, testData, textMessage -> {});
// This will throw a run time error in TestBean#error
testData = Collections.singletonList("error");
produceAndCheck(bean, testData, TEST_TOPIC_ERROR, Collections.singletonList("10"));
Expand Down

0 comments on commit a6130ed

Please sign in to comment.