Skip to content

LoadBalancedRSocketMono (LatencySubscriber) does not seem to propagate subscriber context properly #822

@a701440

Description

@a701440

I am trying to pass additional information in subscriber context through the LoadBalancedRSocketMono to my implementation of RSocket. It seems like LoadBalancedRSocketMono does not properly propagate it up the subscription chain.

After debugging it for a bit it looks like subscriber context is present as expected on the
LatencySubscriber child argument. (child.currentContext() has the data), but then it's lost when subscribing to the source.

LB.getRSocket().flatMap(rsocket -> {
       return rsocket.requestResponse(request).subscriberContext(resultsSink.currentContext());
    })

In this case rsocket is the WeightedRSocket from the LB. I see that resultsSink.currentContext() has correct data, but when the call arrives to the actual RSocket wrapped in the WeightedRSocket in a function like this:

@Override
public Mono<Payload> requestResponse(Payload payload) {
    return delegate.requestResponse(payload).subscriberContext(ctx -> {
        // expecting that higher level subscriber context data would be available here...
        // same problem exists when using Mono.subscriberContext()...
        return ctx;
   });
}

I see that ctx is empty and is missing the data that was provided to the WeightedRSocket.
It appears that as LB is creating the handler chain the context is not properly propagated at some point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions