Skip to content

Commit 9fde6ad

Browse files
authored
Add README instructions to examples [HZ-5257] (#1395)
Add README instructions to examples.
1 parent 0a350fd commit 9fde6ad

File tree

26 files changed

+171
-53
lines changed

26 files changed

+171
-53
lines changed

examples/README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,27 @@ This folder contains an extensive collection of Hazelcast C++ Client code sample
7373

7474
See reference
7575
manual [Advanced Installation section](https://docs.hazelcast.com/hazelcast/latest/clients/cplusplus#advanced-installation)
76-
to build and run the examples.
76+
to build the examples (Basically, you use the `-DBUILD_EXAMPLES=ON` flag for cmake).
77+
78+
In order to run the examples, you need to have a Hazelcast cluster
79+
running. You can either use a local Hazelcast cluster or a Hazelcast
80+
Cloud cluster. For local Hazelcast cluster, you can follow the instructions
81+
in the [Start a Local Cluster in Docker](https://docs.hazelcast.com/hazelcast/latest/getting-started/get-started-docker)
82+
to set up a Hazelcast cluster on your local machine.
83+
84+
Some examples may require Enterprise features. In that case, you need to have a Hazelcast
85+
Enterprise cluster running. For local Hazelcast Enterprise cluster,
86+
you can follow the instructions in
87+
the [Get started with Hazelcast Enterprise Edition](https://docs.hazelcast.com/hazelcast/latest/getting-started/get-started-enterprise)
88+
to set up a Hazelcast Enterprise cluster on your local machine.
89+
90+
Some examples may require additional configuration on the server side. The server configuration xml files are provided
91+
in the respective example folders. You can use these configuration files when starting the Hazelcast server instances.
92+
93+
Once you have a Hazelcast cluster running, you can run the examples which you already built as described above. The
94+
built example binaries are located in the `<BUILD_FOLDER_PATH>/examples/` folder. Navigate to the respective example
95+
folder and run the example binary. You can also see the example binary name in the CMakeLists.txt file located at
96+
the respective example folder.
97+
98+
In order to run some of the examples, you may need to provide the additional jar files at the server classpath. The
99+
required jar files are mentioned in the respective example README files.

examples/authentication/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/backpressure/README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
# enableBackPressure
22

3-
- Start server:
4-
5-
```bash
6-
java -Dhazelcast.config=examples/backpressure/hazelcast-backpressure.xml -cp hazelcast-enterprise-<SERVER VERSION>.jar:hazelcast-<SERVER VERSION>-tests.jar com.hazelcast.core.server.HazelcastMemberStarter
7-
```
8-
9-
- Run client test:
10-
11-
```bash
12-
./build/examples/backpressure/enableBackPressure
13-
```
3+
Please add the hazelcast test jar into server classpath to run this example. E.g. hazelcast-<SERVER VERSION>-tests.jar
4+
You can obtain the test jar from the Maven repository:
5+
https://repo1.maven.org/maven2/com/hazelcast/hazelcast/<SERVER VERSION>/hazelcast-<SERVER VERSION>-tests.jar
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
# Client Statistics Example
1+
# clientStatistics
22

3-
- Start server:
4-
5-
```bash
6-
java -jar hazelcast-<SERVER VERSION>.jar
7-
```
8-
9-
- Run client test:
10-
11-
```bash
12-
./build/examples/client-statistics/clientStatistics
13-
```
14-
15-
- Management Center
16-
- Start MC using the instructions at https://docs.hazelcast.com/management-center/latest/getting-started/install
17-
- Open MC in your browser at http://localhost:8080
18-
- Connect to the Hazelcast cluster
19-
- Go to the "Clients" section and observe the client statistics being reported for the test client.
3+
You need to start the Hazelcast Management Center to see the client statistics(
4+
see [Install and start Management Center](https://docs.hazelcast.com/management-center/latest/getting-started/install)).
5+
You can see the details about
6+
client statistics
7+
at [View details about a connected client](https://docs.hazelcast.com/management-center/latest/clusters/clients#view-details-about-a-connected-client)

examples/cp/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# CP Subsystem Examples
2+
3+
This is an enterprise feature. Make sure you are running Hazelcast Enterprise Edition cluster to use these examples.
4+
5+
You can find the detailed information about Hazelcast CP Subsystem and how to quick start
6+
at [Quickstart](https://docs.hazelcast.com/hazelcast/latest/cp-subsystem/configuration#quickstart).

examples/distributed-collections/blockingqueue/Consumer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ main()
3434
} else {
3535
std::cout << "Retrieved item is null." << std::endl;
3636
}
37-
std::this_thread::sleep_for(std::chrono::seconds(5));
3837
}
3938
std::cout << "Consumer Finished!" << std::endl;
4039

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Blocking Queue Example
2+
3+
Make sure you start the consumer first to avoid losing messages.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Item Listener Example
2+
3+
Make sure that you start the listener first to avoid missing any events.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# IMap Basic Example
2+
3+
Make sure you run the `fillmap` first to populate the map before running the printall.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Custom Attributes Example
2+
3+
Write the Java class corresponding to the Car class and put that class or jar (`<my_factory>.jar`) into the classpath
4+
when starting the server and also add a server config for adding the serializer factory to the server.

0 commit comments

Comments
 (0)