use of reactor.util.context.Context in project reactor-netty by reactor.
the class FluxReceive method onInboundError.
final void onInboundError(Throwable err) {
if (isCancelled() || inboundDone) {
Context c = receiver == null ? Context.empty() : receiver.currentContext();
Operators.onErrorDropped(err, c);
return;
}
CoreSubscriber<?> receiver = this.receiver;
this.inboundError = err;
this.inboundDone = true;
if (channel.isActive()) {
channel.close();
}
if (receiverFastpath && receiver != null) {
parent.context.fireContextError(err);
receiver.onError(err);
} else {
drainReceiver();
}
}
use of reactor.util.context.Context in project reactor-core by reactor.
the class MonoSubscriberContext method subscribe.
@Override
public void subscribe(CoreSubscriber<? super T> actual) {
Context c;
try {
c = doOnContext.apply(actual.currentContext());
} catch (Throwable t) {
Operators.error(actual, Operators.onOperatorError(t, actual.currentContext()));
return;
}
source.subscribe(new FluxContextStart.ContextStartSubscriber<>(actual, c));
}
use of reactor.util.context.Context in project reactor-core by reactor.
the class MonoCurrentContext method subscribe.
@SuppressWarnings("unchecked")
public void subscribe(CoreSubscriber<? super Context> actual) {
Context ctx = actual.currentContext();
actual.onSubscribe(Operators.scalarSubscription(actual, ctx));
}
use of reactor.util.context.Context in project reactor-core by reactor.
the class DefaultContextExpectationsTest method notContainsOnlyOfContextContent.
@Test
public void notContainsOnlyOfContextContent() throws Exception {
Context expected = Context.of("foo", "bar", "other", "stuff");
assertContextExpectationFails(s -> s.subscriberContext(Context.of("foo", "bar", "foobar", "baz")), e -> e.containsOnly(expected)).withMessage("Expected Context Context2{foo=bar, foobar=baz} to contain " + "same values as Context2{foo=bar, other=stuff}, but they differ in content");
}
use of reactor.util.context.Context in project reactor-core by reactor.
the class DefaultStepVerifierBuilder method expectNoAccessibleContext.
@Override
public DefaultStepVerifierBuilder<T> expectNoAccessibleContext() {
return consumeSubscriptionWith(sub -> {
Scannable lowest = Scannable.from(sub);
Scannable verifierSubscriber = Scannable.from(lowest.scan(Scannable.Attr.ACTUAL));
Context c = Flux.fromStream(verifierSubscriber.parents()).ofType(CoreSubscriber.class).map(CoreSubscriber::currentContext).blockLast();
if (c != null) {
throw errorFormatter.assertionError("Expected no accessible Context, got " + c);
}
});
}
Aggregations