Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,27 @@ This folder contains an extensive collection of Hazelcast C++ Client code sample

See reference
manual [Advanced Installation section](https://docs.hazelcast.com/hazelcast/latest/clients/cplusplus#advanced-installation)
to build and run the examples.
to build the examples (Basically, you use the `-DBUILD_EXAMPLES=ON` flag for cmake).

In order to run the examples, you need to have a Hazelcast cluster
running. You can either use a local Hazelcast cluster or a Hazelcast
Cloud cluster. For local Hazelcast cluster, you can follow the instructions
in the [Start a Local Cluster in Docker](https://docs.hazelcast.com/hazelcast/latest/getting-started/get-started-docker)
to set up a Hazelcast cluster on your local machine.

Some examples may require Enterprise features. In that case, you need to have a Hazelcast
Enterprise cluster running. For local Hazelcast Enterprise cluster,
you can follow the instructions in
the [Get started with Hazelcast Enterprise Edition](https://docs.hazelcast.com/hazelcast/latest/getting-started/get-started-enterprise)
to set up a Hazelcast Enterprise cluster on your local machine.

Some examples may require additional configuration on the server side. The server configuration xml files are provided
in the respective example folders. You can use these configuration files when starting the Hazelcast server instances.

Once you have a Hazelcast cluster running, you can run the examples which you already built as described above. The
built example binaries are located in the `<BUILD_FOLDER_PATH>/examples/` folder. Navigate to the respective example
folder and run the example binary. You can also see the example binary name in the CMakeLists.txt file located at
the respective example folder.

In order to run some of the examples, you may need to provide the additional jar files at the server classpath. The
required jar files are mentioned in the respective example README files.
21 changes: 0 additions & 21 deletions examples/authentication/README.md

This file was deleted.

14 changes: 3 additions & 11 deletions examples/backpressure/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# enableBackPressure

- Start server:

```bash
java -Dhazelcast.config=examples/backpressure/hazelcast-backpressure.xml -cp hazelcast-enterprise-<SERVER VERSION>.jar:hazelcast-<SERVER VERSION>-tests.jar com.hazelcast.core.server.HazelcastMemberStarter
```

- Run client test:

```bash
./build/examples/backpressure/enableBackPressure
```
Please add the hazelcast test jar into server classpath to run this example. E.g. hazelcast-<SERVER VERSION>-tests.jar
You can obtain the test jar from the Maven repository:
https://repo1.maven.org/maven2/com/hazelcast/hazelcast/<SERVER VERSION>/hazelcast-<SERVER VERSION>-tests.jar
24 changes: 6 additions & 18 deletions examples/client-statistics/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
# Client Statistics Example
# clientStatistics

- Start server:

```bash
java -jar hazelcast-<SERVER VERSION>.jar
```

- Run client test:

```bash
./build/examples/client-statistics/clientStatistics
```

- Management Center
- Start MC using the instructions at https://docs.hazelcast.com/management-center/latest/getting-started/install
- Open MC in your browser at http://localhost:8080
- Connect to the Hazelcast cluster
- Go to the "Clients" section and observe the client statistics being reported for the test client.
You need to start the Hazelcast Management Center to see the client statistics(
see [Install and start Management Center](https://docs.hazelcast.com/management-center/latest/getting-started/install)).
You can see the details about
client statistics
at [View details about a connected client](https://docs.hazelcast.com/management-center/latest/clusters/clients#view-details-about-a-connected-client)
6 changes: 6 additions & 0 deletions examples/cp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CP Subsystem Examples

This is an enterprise feature. Make sure you are running Hazelcast Enterprise Edition cluster to use these examples.

You can find the detailed information about Hazelcast CP Subsystem and how to quick start
at [Quickstart](https://docs.hazelcast.com/hazelcast/latest/cp-subsystem/configuration#quickstart).
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ main()
} else {
std::cout << "Retrieved item is null." << std::endl;
}
std::this_thread::sleep_for(std::chrono::seconds(5));
}
std::cout << "Consumer Finished!" << std::endl;

Expand Down
3 changes: 3 additions & 0 deletions examples/distributed-collections/blockingqueue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Blocking Queue Example

Make sure you start the consumer first to avoid losing messages.
3 changes: 3 additions & 0 deletions examples/distributed-collections/itemlisteners/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Item Listener Example

Make sure that you start the listener first to avoid missing any events.
3 changes: 3 additions & 0 deletions examples/distributed-map/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# IMap Basic Example

Make sure you run the `fillmap` first to populate the map before running the printall.
4 changes: 4 additions & 0 deletions examples/distributed-map/custom-attributes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Custom Attributes Example

Write the Java class corresponding to the Car class and put that class or jar (`<my_factory>.jar`) into the classpath
when starting the server and also add a server config for adding the serializer factory to the server.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-5.6.xsd">

<serialization>
<data-serializable-factories>
<data-serializable-factory factory-id="???">
com.hazelcast.client.test.MyIdentifiedDataSerializableFactory
</data-serializable-factory>
</data-serializable-factories>
</serialization>
</hazelcast>
3 changes: 3 additions & 0 deletions examples/distributed-map/entry-listener/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# IMap Entry Listener Example

Please make sure to start the listener first to avoid missing any events.
4 changes: 4 additions & 0 deletions examples/distributed-map/entry-processor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Entry Processor Example

- Write the Java class corresponding to the `employee` class and put that class or jar (`<my_factory>.jar`) into the
classpath when starting the server and also add a server config for adding the serializer factory to the server.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-5.6.xsd">

<serialization>
<data-serializable-factories>
<data-serializable-factory factory-id="???">
com.hazelcast.client.test.MyIdentifiedDataSerializableFactory
</data-serializable-factory>
</data-serializable-factories>
</serialization>
</hazelcast>
5 changes: 5 additions & 0 deletions examples/distributed-map/partitionaware/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# PartitionAware Example

Write the Java class corresponding to the `PartitionAwareString` class and put that class or jar (`<my_factory>.jar`)
into the classpath when starting the server and also add a server config for adding the serializer factory to the
server.
5 changes: 5 additions & 0 deletions examples/distributed-map/query/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Query Example

Write the Java class corresponding to the `employee`, `person`, `employee_entry_comparator`,
`employee_entry_key_comparator` classes and put the classes or jar (`<my_factory>.jar`) into the classpath when
starting the server and also add a server config for adding the serializer factory to the server.
4 changes: 4 additions & 0 deletions examples/distributed-map/removeAll/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# RemoveAll Example

Write the Java class corresponding to the `Person`, class and put the class or jar (`<my_factory>.jar`) into the
classpath when starting the server and also add a server config for adding the serializer factory to the server.
3 changes: 3 additions & 0 deletions examples/distributed-topic/reliabletopic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ReliableTopic Example

Make sure that you start the `rtSubscriber` first to avoid missing any events.
3 changes: 3 additions & 0 deletions examples/replicated-map/entry-listener/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ReplicatedMap EntryListener Example

Make sure that you start the `ListeningMember` first to avoid missing any events.
5 changes: 5 additions & 0 deletions examples/serialization/compact/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Compact Serialization Example

Write the Java class corresponding to the `PersonDTO` class, it's serializer class and put that class or
jar (`<my_factory>.jar`) into the classpath when starting the server and also add a server config for adding the
serializer factory to the server.
5 changes: 5 additions & 0 deletions examples/serialization/custom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Custom Serialization Example

Write the Java class corresponding to the `Person` class, it's serializer class and put that class or
jar (`<my_factory>.jar`) into the classpath when starting the server and also add a server config for adding the
serializer factory to the server.
5 changes: 5 additions & 0 deletions examples/serialization/globalserializer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Global Serializer Example

Write the Java class corresponding to the `MyGlobalSerializer` class and put that class or
jar (`<my_factory>.jar`) into the classpath when starting the server and also add a server config for adding the
serializer factory to the server.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# IdentifiedDataSerializable Example

Write the Java class corresponding to the `Person` class, it's serializer class and put that class or
jar (`<my_factory>.jar`) into the classpath when starting the server and also add a server config for adding the
serializer factory to the server.
5 changes: 5 additions & 0 deletions examples/serialization/portable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Portable Serializer Example

Write the Java class corresponding to the `Person` class, it's serializer class and put that class or
jar (`<my_factory>.jar`) into the classpath when starting the server and also add a server config for adding the
serializer factory to the server.
5 changes: 5 additions & 0 deletions examples/sql/README
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ hazelcast config xml file (or similarly with yaml or embedded server configurati
```

A sample xml file is shared in this example folder.

In order to run the portable example (`sql_query_with_portable`), you need to
Write the Java class corresponding to the `Person` class, it's serializer class and put that class or
jar (`<my_factory>.jar`) into the classpath when starting the server and also add a server config for adding the
serializer factory to the server.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
serializer factory to the server.
serializer factory to the server.

Nit line ending

5 changes: 4 additions & 1 deletion examples/sql/hazelcast-sql.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<hazelcast xmlns="http://www.hazelcast.com/schema/config">
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-5.6.xsd">

<jet enabled="true" />

Expand Down
Loading