Skip to content

Commit

Permalink
[#2720]Improve ReactiveLoadBalancerClientFilter implementation so tha…
Browse files Browse the repository at this point in the history
…t we can pass attribute to ReactiveLoadBalancer (#2721)
  • Loading branch information
liubao68 authored Mar 8, 2024
1 parent 688391a commit e6d237c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
.getSupportedLifecycleProcessors(clientFactory.getInstances(serviceId, LoadBalancerLifecycle.class),
RequestDataContext.class, ResponseData.class, ServiceInstance.class);
DefaultRequest<RequestDataContext> lbRequest = new DefaultRequest<>(
new RequestDataContext(new RequestData(exchange.getRequest()), getHint(serviceId)));
new RequestDataContext(new RequestData(exchange.getRequest(), exchange.getAttributes()), getHint(serviceId)));
return choose(lbRequest, serviceId, supportedLifecycleProcessors).doOnNext(response -> {

if (!response.hasServer()) {
Expand Down Expand Up @@ -154,7 +154,7 @@ public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
.onComplete(new CompletionContext<ResponseData, ServiceInstance, RequestDataContext>(
CompletionContext.Status.SUCCESS, lbRequest,
exchange.getAttribute(GATEWAY_LOADBALANCER_RESPONSE_ATTR),
new ResponseData(exchange.getResponse(), new RequestData(exchange.getRequest()))))));
new ResponseData(exchange.getResponse(), new RequestData(exchange.getRequest(), exchange.getAttributes()))))));
}

protected URI reconstructURI(ServiceInstance serviceInstance, URI original) {
Expand Down

0 comments on commit e6d237c

Please sign in to comment.