Skip to content

Commit 3a5e7d1

Browse files
committed
Add zookeeper example
1 parent 971133c commit 3a5e7d1

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

example/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<artifactId>gcm-hive</artifactId>
5151
<version>${project.version}</version>
5252
</dependency>
53+
<dependency>
54+
<groupId>io.edurt.gcm</groupId>
55+
<artifactId>gcm-zookeeper</artifactId>
56+
<version>${project.version}</version>
57+
</dependency>
5358
</dependencies>
5459

5560
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package io.edurt.gcm.example.general;
15+
16+
import com.google.inject.Guice;
17+
import com.google.inject.Inject;
18+
import io.edurt.gcm.zookeeper.ZookeeperModule;
19+
import io.edurt.gcm.zookeeper.client.ZookeeperClient;
20+
21+
public class ZookeeperExample
22+
{
23+
@Inject
24+
private ZookeeperClient zookeeperClient;
25+
26+
public static void main(String[] args)
27+
{
28+
String classpath = ZookeeperExample.class.getResource("/general/zookeeper.properties").getPath();
29+
ZookeeperExample instance = Guice.createInjector(new ZookeeperModule(classpath))
30+
.getInstance(ZookeeperExample.class);
31+
System.out.println(instance.zookeeperClient.getNode("localhost"));
32+
}
33+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
zookeeper.service=localhost:2181
2+
zookeeper.session-timeout=5000
3+
zookeeper.connection-timeout=5000
4+
zookeeper.retry=3
5+
zookeeper.namespace=default

0 commit comments

Comments
 (0)