Handle new Reactor Emission FAIL_NON_SERIALIZED

* Rework WebFlux test to JUnit 5
This commit is contained in:
Artem Bilan
2020-09-11 14:12:09 -04:00
parent 481d5eb2a5
commit 09dec2eab5
8 changed files with 30 additions and 34 deletions

View File

@@ -83,6 +83,9 @@ public class FluxMessageChannel extends AbstractMessageChannel
private boolean tryEmitMessage(Message<?> message) {
switch (this.sink.tryEmitNext(message)) {
case OK:
return true;
case FAIL_NON_SERIALIZED:
case FAIL_OVERFLOW:
return false;
case FAIL_TERMINATED:
@@ -90,7 +93,7 @@ public class FluxMessageChannel extends AbstractMessageChannel
throw new IllegalStateException("Cannot emit messages into the cancelled or terminated sink: "
+ this.sink);
default:
return true;
throw new UnsupportedOperationException();
}
}

View File

@@ -124,14 +124,14 @@ public final class IntegrationReactiveUtils {
}
}
@SuppressWarnings("unchecked")
private static <T> Flux<Message<T>> adaptSubscribableChannelToPublisher(SubscribableChannel inputChannel) {
return Flux.defer(() -> {
Sinks.Many<Message<T>> sink = Sinks.many().unicast().onBackpressureError();
MessageHandler messageHandler = (message) -> {
while (true) {
@SuppressWarnings("unchecked")
Sinks.Emission emission = sink.tryEmitNext((Message<T>) message);
switch (emission) {
switch (sink.tryEmitNext((Message<T>) message)) {
case FAIL_NON_SERIALIZED:
case FAIL_OVERFLOW:
LockSupport.parkNanos(1000); // NOSONAR
break;