alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.94k stars 8.34k forks source link

dubbo with sentinel && @dubbotransported #654

Open halower opened 5 years ago

halower commented 5 years ago

Which Component Dubbo

Describe the bug

  1. the 0.9.0 version uses @dubbotransported () to find that it does not appear to have been invoked through Dubbo because the service provider's RpcContext.getContext (). getUrl () is always null

  2. if used Sentinel and @FeignClient at the same time, fallback will be ineffective, remove Dubbo will return to normal, but hystrix no problem

To Reproduce Steps to reproduce the behavior: to Scenario 1:

@FeignClient(value = "demo-service",fallback = UserServiceMock.class)
@DubboTransported()
public interface TestService{
    @PostMapping("/api/user/hello")
    String login(@RequestBody LoginUserDto userDto);
}
@Service
@RestController
public class DubboTestService implements TestService {

    @Override
    public String login(LoginUserDto userDto) {
        return RpcContext.getContext().getUrl() + "[echo]:" + userDto.toString();
    }
}

to Scenario 2:

implementation ("org.springframework.cloud:spring-cloud-alibaba-dubbo:sentinel:0.9.0.RELEASE")
implementation ("org.springframework.cloud:spring-cloud-starter-alibaba-sentinel:0.9.0.RELEASE")

feign:
  sentinel:
    enabled: true
fangjian0423 commented 5 years ago

Maybe it is not compatibility with Sentinel.

I will check it soon.