Giter VIP home page Giter VIP logo

Comments (12)

xionghuiCoder avatar xionghuiCoder commented on May 21, 2024

DubboProperties里面是一些provider和consumer的公共配置,其它配置可在注解@service(provider端)和@reference(consumer端)里面配置。

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

Is the @Service annotation's filter property is actually used? I looked at the source code for dubbo and it doesn't seem to use it. Were you able to get this to work?

from dubbo-spring-boot-starter.

xionghuiCoder avatar xionghuiCoder commented on May 21, 2024

@adriancole hi, @service annotation's filter property is inited in com.alibaba.dubbo.config.AbstractConfig#appendAnnotation, line 435. It works already in dubbo 2.6.0.

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

thanks. please ignore me on this one. I think I have a misunderstanding about how filter lifecycle works. I have found manually that a setter in trace filter was never called https://github.com/openzipkin/sleuth-webmvc-example/compare/add-dubbo-tracing

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

I guess I'd like to externalize the filter config as opposed to hard-code it on the annotation

@chickenlj mentioned to me this:

 XML looks like this:

<!-- default timeout and filter for all services -->
<dubbo:consumer timeout="5000" filter="tracing" />
And annotation or spring boot, use .properties instead, for example:

dubbo.consumer.filter="tracing"

I tried in spring boot's properties file, even in a separate dubbo.properties file. Seems like filter should be something that we can do in spring boot style somehow (change without require user's code to change), ex via spring boot properties or autoconfiguration..

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

sorry forgot to mention above was @chickenlj

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

PS please hold an hour I was using a stale version of spring-cloud-sleuth.

We had to change sleuth as dubbo requires the bean name to exact match the extension name, so we changed sleuth to make sure it is exactly the same. I will update instructions on my end, and summarize progress in an hour.

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

ok so right now, as far as I can tell, there is no way to use spring boot (application.properties or autoconfig) to assign a global filter. The only way is external to spring boot, ex via a dubbo.properties file

dubbo.provider.filter=tracing
dubbo.consumer.filter=tracing

This works, but the problem is that in spring boot you will not see this and it won't be intuitive. For example if I hit the /autoconfig endpoint it will not know about this properties file.

It would be nice to be able to define a bean like this:

@GlobalFilter @Bean Filter tracing(Tracing tracing) {
  TracingFilter result = new TracingFilter();
  result.setTracing(tracing);
  return tracing;
}

and have the above as the same as if it were set by properties "dubbo.provider.filter=tracing" and "dubbo.consumer.filter=tracing". However, I noticed that the extension loader for filter happens before hand because the filter itself is registered in meta-inf. In other words the statically initialized filter works instead.

For this reason, the simplest way out could just be allowing the spring boot starter here to define

spring.dubbo.provider.filter=tracing
spring.dubbo.consumer.filter=tracing

As long as spring is at least in control of the property names, we should be able to automatically insert the word tracing with spring-cloud-sleuth.

Does this make sense?

from dubbo-spring-boot-starter.

mercyblitz avatar mercyblitz commented on May 21, 2024

@adriancole Please switch to this starter : https://github.com/dubbo/dubbo-spring-boot-project , which is official starter, thanks!

from dubbo-spring-boot-starter.

codefromthecrypt avatar codefromthecrypt commented on May 21, 2024

@mercyblits I have been told both are official, but I suppose dubbo is the more official one now (due to apache I guess?)

from dubbo-spring-boot-starter.

mercyblitz avatar mercyblitz commented on May 21, 2024

@adriancole yes, https://github.com/dubbo/dubbo-spring-boot-project is more better :D

from dubbo-spring-boot-starter.

xionghuiCoder avatar xionghuiCoder commented on May 21, 2024

Duplicate of #72

from dubbo-spring-boot-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.