Skip to content

Commit

Permalink
Move the loadbalancer module
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengJie1053 committed Nov 22, 2023
1 parent d73b4d3 commit 3070308
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ public class RpcConstant {
public static final String LINKIS_LOAD_BALANCER_TYPE = "LinkisLoadBalancerType";

public static final String LINKIS_LOAD_BALANCER_TYPE_RPC = "RPC";

public static final String FIXED_INSTANCE = "client-ip";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.linkis.gateway.springcloud.loadbalancer;
package org.apache.linkis.rpc.loadbalancer;

import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.linkis.gateway.springcloud.loadbalancer;
package org.apache.linkis.rpc.loadbalancer;

import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* limitations under the License.
*/

package org.apache.linkis.gateway.springcloud.loadbalancer;
package org.apache.linkis.rpc.loadbalancer;

import org.apache.linkis.gateway.springcloud.constant.GatewayConstant;
import org.apache.linkis.rpc.conf.EurekaClientCacheManualRefresher;
import org.apache.linkis.rpc.constant.RpcConstant;
import org.apache.linkis.rpc.errorcode.LinkisRpcErrorCodeSummary;
Expand Down Expand Up @@ -78,7 +77,7 @@ public Mono<Response<ServiceInstance>> choose(Request request) {
((RequestDataContext) request.getContext())
.getClientRequest()
.getHeaders()
.get(GatewayConstant.FIXED_INSTANCE);
.get(RpcConstant.FIXED_INSTANCE);
String clientIp = CollectionUtils.isNotEmpty(clientIpList) ? clientIpList.get(0) : null;
ServiceInstanceListSupplier supplier =
serviceInstanceListSupplierProvider.getIfAvailable(NoopServiceInstanceListSupplier::new);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.linkis.gateway.security.LinkisPreFilter$;
import org.apache.linkis.gateway.security.SecurityFilter;
import org.apache.linkis.gateway.springcloud.SpringCloudGatewayConfiguration;
import org.apache.linkis.gateway.springcloud.constant.GatewayConstant;
import org.apache.linkis.rpc.constant.RpcConstant;
import org.apache.linkis.server.Message;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -135,7 +135,7 @@ private Route getRealRoute(
exchange
.getRequest()
.mutate()
.header(GatewayConstant.FIXED_INSTANCE, serviceInstance.getInstance());
.header(RpcConstant.FIXED_INSTANCE, serviceInstance.getInstance());
}
return Route.async()
.id(route.getId())
Expand Down

0 comments on commit 3070308

Please sign in to comment.