| 1 | #include <Common/ZooKeeper/ZooKeeperImpl.h> | 
|---|
| 2 | #include <iostream> | 
|---|
| 3 |  | 
|---|
| 4 |  | 
|---|
| 5 | int main() | 
|---|
| 6 | try | 
|---|
| 7 | { | 
|---|
| 8 | Coordination::ZooKeeper zookeeper({Poco::Net::SocketAddress{ "localhost:2181"}}, "", "", "", {30, 0}, {0, 50000}, {0, 50000}); | 
|---|
| 9 |  | 
|---|
| 10 | zookeeper.create( "/test", "hello", false, false, {}, [](const Coordination::CreateResponse & response) | 
|---|
| 11 | { | 
|---|
| 12 | if (response.error) | 
|---|
| 13 | std::cerr << "Error "<< response.error << ": "<< Coordination::errorMessage(response.error) << "\n"; | 
|---|
| 14 | else | 
|---|
| 15 | std::cerr << "Path created: "<< response.path_created << "\n"; | 
|---|
| 16 | }); | 
|---|
| 17 |  | 
|---|
| 18 | sleep(100); | 
|---|
| 19 |  | 
|---|
| 20 | return 0; | 
|---|
| 21 | } | 
|---|
| 22 | catch (...) | 
|---|
| 23 | { | 
|---|
| 24 | DB::tryLogCurrentException(__PRETTY_FUNCTION__); | 
|---|
| 25 | return 1; | 
|---|
| 26 | } | 
|---|
| 27 |  | 
|---|