Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimizes the structure of config module and discovery module #774

Merged
merged 10 commits into from
Apr 15, 2019
Merged

optimizes the structure of config module and discovery module #774

merged 10 commits into from
Apr 15, 2019

Conversation

xingfudeshi
Copy link
Member

@xingfudeshi xingfudeshi commented Apr 12, 2019

Ⅰ. Describe what this PR did

In practical applications, for configuration centers and registries, multiple types are not used at the same time, such as Zookeeper, Nacos and so on. Therefore, these dependencies should be optional, allowing users to decide what dependencies to download.
So,this PR provides a way for users to decide which dependencies to use and download by themselves. By default, File-based configuration and registry have been provided.
for example:
if you need only the support for Spring,you can import the following dependency

Maven dependency

<fescar.version>0.4.2</fescar.version>

<dependency>
    <groupId>com.alibaba.fescar</groupId>
    <artifactId>fescar-spring</artifactId>
    <version>${fescar.version}</version>
</dependency>

As described before,by default,only File-based configuration and registry will be provided.so,in registry.conf,the value of type for both registry and config should be file.

registry {
  # file 、nacos 、eureka、redis、zk、consul
  type = "file"
...
config {
  # file、nacos 、apollo、zk
  type = "file"
...

In another case,you may want to use the Nacos as the configuration center,and the consul for registry,then you just need import two more dependencies as bellow:

<dependency>
    <groupId>com.alibaba.fescar</groupId>
    <artifactId>fescar-config-nacos</artifactId>
    <version>${fescar.version}</version>
</dependency>
<dependency>
    <groupId>com.alibaba.fescar</groupId>
    <artifactId>fescar-discovery-consul</artifactId>
    <version>${fescar.version}</version>
</dependency>

and modify the value in registry.conf,the final configuration should look like the following:

registry {
  # file 、nacos 、eureka、redis、zk、consul
  type = "consul"
...
config {
  # file、nacos 、apollo、zk
  type = "nacos"
...

In addition, you can use the following two dependencies, which import all Seata-supported configuration centers and registries.

<dependency>
    <groupId>com.alibaba.fescar</groupId>
    <artifactId>fescar-config-all</artifactId>
    <version>${fescar.version}</version>
</dependency>
<dependency>
    <groupId>com.alibaba.fescar</groupId>
    <artifactId>fescar-discovery-all</artifactId>
    <version>${fescar.version}</version>
</dependency>

Ⅱ. Does this pull request fix one issue?

#760
#755
#601

Ⅲ. Why don't you add test cases (unit test/integration test)?

i have done the integration testing.and,i didn't modify the original implementation.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@xingfudeshi xingfudeshi reopened this Apr 12, 2019
@codecov-io
Copy link

codecov-io commented Apr 12, 2019

Codecov Report

Merging #774 into develop will increase coverage by 1.66%.
The diff coverage is 18.75%.

Impacted file tree graph

@@             Coverage Diff              @@
##             develop    #774      +/-   ##
============================================
+ Coverage      32.73%   34.4%   +1.66%     
+ Complexity       936     889      -47     
============================================
  Files            228     215      -13     
  Lines           9103    8299     -804     
  Branches        1108     996     -112     
============================================
- Hits            2980    2855     -125     
+ Misses          5766    5104     -662     
+ Partials         357     340      -17
Impacted Files Coverage Δ Complexity Δ
...ar/discovery/registry/FileRegistryServiceImpl.java 61.53% <ø> (ø) 7 <0> (?)
...libaba/fescar/discovery/registry/RegistryType.java 40% <ø> (ø) 2 <0> (?)
...r/discovery/loadbalance/RoundRobinLoadBalance.java 66.66% <ø> (ø) 3 <0> (?)
...scar/discovery/loadbalance/LoadBalanceFactory.java 66.66% <ø> (ø) 1 <0> (?)
...car/discovery/loadbalance/AbstractLoadBalance.java 66.66% <ø> (ø) 3 <0> (?)
...escar/discovery/loadbalance/RandomLoadBalance.java 100% <ø> (ø) 2 <0> (?)
...ery/registry/consul/ConsulRegistryServiceImpl.java 0% <ø> (ø) 0 <0> (?)
...covery/registry/consul/ConsulRegistryProvider.java 0% <0%> (ø) 0 <0> (?)
...scar/core/rpc/netty/AbstractRpcRemotingClient.java 20.57% <5%> (+2.66%) 7 <0> (ø) ⬇️
...aba/fescar/discovery/registry/RegistryFactory.java 50% <50%> (ø) 2 <2> (?)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 117f3da...78f9ae4. Read the comment docs.

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

config/fescar-config-zk/pom.xml Show resolved Hide resolved
config/fescar-config-all/pom.xml Show resolved Hide resolved
config/fescar-config-apollo/pom.xml Show resolved Hide resolved
config/fescar-config-core/pom.xml Show resolved Hide resolved
discovery/fescar-discovery-all/pom.xml Show resolved Hide resolved
discovery/fescar-discovery-core/pom.xml Show resolved Hide resolved
discovery/fescar-discovery-eureka/pom.xml Show resolved Hide resolved
discovery/fescar-discovery-nacos/pom.xml Show resolved Hide resolved
discovery/fescar-discovery-redis/pom.xml Show resolved Hide resolved
discovery/fescar-discovery-zk/pom.xml Show resolved Hide resolved
@lovepoem
Copy link
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants