zkconfig-resources

A ZooKeeper based configuration resources holder

License

License

The Artistic License 2.0
Categories

Categories

Ant Build Tools config Application Layer Libs Configuration
GroupId

GroupId

com.github.phantomthief
ArtifactId

ArtifactId

zkconfig-resources
Last Version

Last Version

1.1.28
Release Date

Release Date

Type

Type

jar
Description

Description

zkconfig-resources
A ZooKeeper based configuration resources holder
Project URL

Project URL

https://github.com/PhantomThief/zkconfig-resources
Source Code Management

Source Code Management

https://github.com/PhantomThief/zkconfig-resources.git

Download zkconfig-resources

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.phantomthief/zkconfig-resources/ -->
<dependency>
    <groupId>com.github.phantomthief</groupId>
    <artifactId>zkconfig-resources</artifactId>
    <version>1.1.28</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.phantomthief/zkconfig-resources/
implementation 'com.github.phantomthief:zkconfig-resources:1.1.28'
// https://jarcasting.com/artifacts/com.github.phantomthief/zkconfig-resources/
implementation ("com.github.phantomthief:zkconfig-resources:1.1.28")
'com.github.phantomthief:zkconfig-resources:jar:1.1.28'
<dependency org="com.github.phantomthief" name="zkconfig-resources" rev="1.1.28">
  <artifact name="zkconfig-resources" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.phantomthief', module='zkconfig-resources', version='1.1.28')
)
libraryDependencies += "com.github.phantomthief" % "zkconfig-resources" % "1.1.28"
[com.github.phantomthief/zkconfig-resources "1.1.28"]

Dependencies

compile (6)

Group / Artifact Type Version
com.github.phantomthief : more-lambdas jar 0.1.8
org.slf4j : slf4j-api jar 1.7.22
org.apache.curator : curator-recipes jar [4.0.0,)
com.google.guava : guava jar 21.0
org.apache.commons : commons-lang3 jar 3.4
com.google.code.findbugs : jsr305 Optional jar 3.0.1

test (5)

Group / Artifact Type Version
org.apache.curator : curator-test jar 4.0.0
org.junit.jupiter : junit-jupiter-api jar 5.0.2
com.fasterxml.jackson.core : jackson-databind jar 2.9.7
ch.qos.logback : logback-classic jar 1.1.8
org.jetbrains.kotlin : kotlin-reflect jar 1.2.51

Project Modules

There are no modules declared in this project.

zkconfig-resources

Build Status Coverage Status Maven Central

ZooKeeper节点缓存,基于CuratorFramework封装

  • 节点变更时,旧资源清理机制
  • 强类型泛型支持
  • 只支持Java8

Get Started

ZkBasedNodeResource<ShardedJedisPool> node = ZkBasedNodeResource.<ShardedJedisPool> newBuilder()
                .withCacheFactory(ZKPaths.makePath("/redis", monitorPath), ZkClientHolder::get)
                .withStringFactory(this::initObject)
                .withCleanup(ShardedJedisPool::close)
                .build();

ShardedJedisPool pool = node.get();                

使用test-zk34测试兼容性

test-zk34默认会打一个bin二进制包,可以利用二进制包来进行curator,zookeeper-client,zookeeper-server各种版本组合进行兼容性的测试。

# 指定curator和zookeeper-client的版本
mvn -Dcurator.version=4.2.0 -Dzookeeper.version=3.6.0 clean install -DskipTests
cd test-zk34/target
tar -xzvf zkconfig-resources-test-zk34-${version}-bin.tar.gz
cd zkconfig-resources-test-zk34-${version}-bin

# 连接localhost:2181并运行所有测试,并强制curator使用zk34兼容模式
TEST_PROP="-Dzk.zk34CompatibilityMode=true" sh bin/run_tests.sh "localhost:2181"

# 没有指定脚本参数,会使用curator-test内置的TestingServer进行测试
sh bin/run_tests.sh

Versions

Version
1.1.28
1.1.27
1.1.26
1.1.25
1.1.24
1.1.23
1.1.22
1.1.21
1.1.20
1.1.19
1.1.18
1.1.17
1.1.16
1.1.15
1.1.14
1.1.13
1.1.12
1.1.11
1.1.10
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0