commit
262d0761c7
@ -1,9 +1,4 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
---
|
---
|
||||||
|
|
||||||
- [Feature: Support custom rate limit reject response info](https://github.com/Tencent/spring-cloud-tencent/pull/153)
|
- [fix:fix wrong context data storage.](https://github.com/Tencent/spring-cloud-tencent/pull/176)
|
||||||
- [Feature: Remove spring-javaformat-maven-plugin](https://github.com/Tencent/spring-cloud-tencent/pull/151)
|
|
||||||
- [feat:optimize config server address.](https://github.com/Tencent/spring-cloud-tencent/pull/149)
|
|
||||||
- [feat: override recover router config](https://github.com/Tencent/spring-cloud-tencent/pull/159)
|
|
||||||
- [feat:refactor loadbalancer module as a basic module for router and circuit breaker.](https://github.com/Tencent/spring-cloud-tencent/pull/155)
|
|
||||||
- [fix:fix routes of gateway doesn't refresh bug.](https://github.com/Tencent/spring-cloud-tencent/pull/163)
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
# Change Log
|
||||||
|
---
|
||||||
|
|
||||||
|
- [Feature: Support custom rate limit reject response info](https://github.com/Tencent/spring-cloud-tencent/pull/153)
|
||||||
|
- [Feature: Remove spring-javaformat-maven-plugin](https://github.com/Tencent/spring-cloud-tencent/pull/151)
|
||||||
|
- [feat:optimize config server address.](https://github.com/Tencent/spring-cloud-tencent/pull/149)
|
||||||
|
- [feat: override recover router config](https://github.com/Tencent/spring-cloud-tencent/pull/159)
|
||||||
|
- [feat:refactor loadbalancer module as a basic module for router and circuit breaker.](https://github.com/Tencent/spring-cloud-tencent/pull/155)
|
||||||
|
- [fix:fix routes of gateway doesn't refresh bug.](https://github.com/Tencent/spring-cloud-tencent/pull/163)
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the BSD 3-Clause License (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://opensource.org/licenses/BSD-3-Clause
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed
|
|
||||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
||||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.tencent.cloud.common.metadata.interceptor.feign;
|
|
||||||
|
|
||||||
import com.tencent.cloud.common.constant.MetadataConstant;
|
|
||||||
import com.tencent.cloud.common.metadata.MetadataContext;
|
|
||||||
import com.tencent.cloud.common.metadata.MetadataContextHolder;
|
|
||||||
import feign.RequestInterceptor;
|
|
||||||
import feign.RequestTemplate;
|
|
||||||
|
|
||||||
import org.springframework.core.Ordered;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interceptor used for setting peer info in context.
|
|
||||||
*
|
|
||||||
* @author Haotian Zhang
|
|
||||||
*/
|
|
||||||
public class MetadataFirstFeignInterceptor implements RequestInterceptor, Ordered {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOrder() {
|
|
||||||
return MetadataConstant.OrderConstant.METADATA_FIRST_FEIGN_INTERCEPTOR_ORDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void apply(RequestTemplate requestTemplate) {
|
|
||||||
// get metadata of current thread
|
|
||||||
MetadataContext metadataContext = MetadataContextHolder.get();
|
|
||||||
|
|
||||||
// TODO The peer namespace is temporarily the same as the local namespace
|
|
||||||
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_NAMESPACE,
|
|
||||||
MetadataContext.LOCAL_NAMESPACE);
|
|
||||||
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE,
|
|
||||||
requestTemplate.feignTarget().name());
|
|
||||||
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_PATH, requestTemplate.path());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue