You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am thinking of providing a fluent -style builder API built on ServiceConfig, ReferenceConfig, ...
It may work like this:
ApplicationConfigapplicationConfig = ApplicationBuilder.name("demo").build();
ServiceConfigserviceConfig = ServiceBuilder.ref(ref).timeout(1000).build();
ReferenceConfigreferenceConfig = ReferenceBuilder.interface("interface name").timeout(2000).build();
DubboBuilderdubboBuilder = DubboBuilder.application(applicationConfig).registry(registryConfig).protocol(protocol);
// To trigger the export/refer process, you can just start dubboBuilderdubboBuilder.services(Arrays.asList(serviceConfig)).references(Arrays.asList(referenceConfig)).start();
// Or, you can export/refer one specific Service or ReferencedubboBuilder.export(serviceConfig);
dubboBuilder.refer(referenceConfig);
At present, one of the problems of using ServiceConfig and ReferenceConfig directly is that some application-level configurations need to be set to each ServiceConfig or ReferenceConfig, which is redundant, unnecessary and inconvenient for users
DubboBuilder.export(ServiceConfig service, ProviderConfig provider, RegistryConfig registry)
java
if users would like to refer specific config to a service or a reference. They can config by themselves.
I would suggest providing the service-restricted configs using ServiceConfigBuilder: ServiceConfigBuilder.provider(The ProviderConfig).registry(The RegistryConfig).build()
A unified entry like DubboBuilder.start() can help us with:
Application level rules. You may have noticed of some application level rules introduced in 2.7.0. The rules are fetched and watched inside each Service, I think it would be better if we can have an application level place to do that.
Adapting to microservice architecture. The microservice model is one microservice per process which is different from Dubbo's interface level service model. A unified entry would make the application level service discovery model more easily achieved.
Activity
chickenlj commentedon Feb 3, 2019
ConfigManager can work as the basis for the Builder: https://github.com/apache/incubator-dubbo/blob/master/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
kun-song commentedon Feb 3, 2019
Good idea!
xxlv commentedon Feb 7, 2019
Cool,I love it
Kiddinglife commentedon Feb 8, 2019
nice
tswstarplanet commentedon Feb 8, 2019
I think the export and refer method of DubboBuilder can provider overload methods such as
chickenlj commentedon Feb 12, 2019
I would suggest providing the service-restricted configs using ServiceConfigBuilder:
ServiceConfigBuilder.provider(The ProviderConfig).registry(The RegistryConfig).build()What do you think? @tswstarplanet
chickenlj commentedon Feb 13, 2019
Is there anyone who's interested and want to give it a try?
tswstarplanet commentedon Feb 14, 2019
Yes, it looks good. We should also limit reproduction of global configs, such as application.
Bricks-Man commentedon Feb 15, 2019
I want to try this issue.And I will commit a pr after serveral days
chickenlj commentedon Feb 15, 2019
Yes, the
ConfigManagerintroduced in 2.7.0 can achieve that, but it may have some room for improvement.chickenlj commentedon Feb 15, 2019
@Bricks-Man Awesome, please let me know if you have any problem.
chickenlj commentedon Feb 15, 2019
Further thought on this topic.
A unified entry like
DubboBuilder.start()can help us with:Bricks-Man commentedon Feb 22, 2019
@chickenlj I have finished this issue.Could you have time to do a review for it?Please tell me if you have any question.
Fluent style builder API support(#3431) (#3549)
Merge master branch to 3.x dev branch (#3718)
cvictory commentedon May 20, 2019
#3661