Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
client_properties.h
1/*
2 * Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <string>
20#include <unordered_map>
21
22#include "hazelcast/util/export.h"
23#include "hazelcast/util/IOUtil.h"
24
25#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26#pragma warning(push)
27#pragma warning(disable : 4251) // for dll export
28#endif
29
30namespace hazelcast {
31namespace client {
32class client_config;
33
39class HAZELCAST_API client_property
40{
41public:
42 client_property(const std::string& name, const std::string& default_value);
43
44 const std::string& get_name() const;
45
46 const std::string& get_default_value() const;
47
54 const char* get_system_property() const;
55
56private:
57 std::string name_;
58 std::string default_value_;
59};
60
66class HAZELCAST_API client_properties
67{
68public:
69 client_properties(
70 const std::unordered_map<std::string, std::string>& properties);
71
72 const client_property& get_heartbeat_timeout() const;
73
74 const client_property& get_heartbeat_interval() const;
75
76 const client_property& get_aws_member_port() const;
77
78 const client_property& get_invocation_retry_pause_millis() const;
79
80 const client_property& get_invocation_timeout_seconds() const;
81
82 const client_property& get_event_thread_count() const;
83
84 const client_property& get_internal_executor_pool_size() const;
85
86 const client_property& get_shuffle_member_list() const;
87
88 const client_property& get_max_concurrent_invocations() const;
89
90 const client_property& get_backpressure_backoff_timeout_millis() const;
91
92 const client_property& get_statistics_enabled() const;
93
94 const client_property& get_statistics_period_seconds() const;
95
96 const client_property& backup_timeout_millis() const;
97
98 const client_property& fail_on_indeterminate_state() const;
99
100 const client_property& cloud_base_url() const;
101
102 const client_property& partition_arg_cache_size() const;
103
113 static const std::string PROP_HEARTBEAT_TIMEOUT;
114 static const std::string PROP_HEARTBEAT_TIMEOUT_DEFAULT;
115
123 static const std::string PROP_HEARTBEAT_INTERVAL;
124 static const std::string PROP_HEARTBEAT_INTERVAL_DEFAULT;
125
135 static const std::string PROP_REQUEST_RETRY_COUNT;
136 static const std::string PROP_REQUEST_RETRY_COUNT_DEFAULT;
137
147 static const std::string PROP_REQUEST_RETRY_WAIT_TIME;
148 static const std::string PROP_REQUEST_RETRY_WAIT_TIME_DEFAULT;
149
157 static const std::string PROP_AWS_MEMBER_PORT;
158 static const std::string PROP_AWS_MEMBER_PORT_DEFAULT;
159
163 static const std::string INVOCATION_RETRY_PAUSE_MILLIS;
164 static const std::string INVOCATION_RETRY_PAUSE_MILLIS_DEFAULT;
165
177 static const std::string INVOCATION_TIMEOUT_SECONDS;
178 static const std::string INVOCATION_TIMEOUT_SECONDS_DEFAULT;
179
183 static const std::string EVENT_THREAD_COUNT;
184 static const std::string EVENT_THREAD_COUNT_DEFAULT;
185
186 static const std::string INTERNAL_EXECUTOR_POOL_SIZE;
187 static const std::string INTERNAL_EXECUTOR_POOL_SIZE_DEFAULT;
188
194 static const std::string SHUFFLE_MEMBER_LIST;
195 static const std::string SHUFFLE_MEMBER_LIST_DEFAULT;
196
206 static const std::string MAX_CONCURRENT_INVOCATIONS;
207 static const std::string MAX_CONCURRENT_INVOCATIONS_DEFAULT;
208
220 static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS;
221 static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS_DEFAULT;
222
228 static const std::string STATISTICS_ENABLED;
229 static const std::string STATISTICS_ENABLED_DEFAULT;
230
234 static const std::string STATISTICS_PERIOD_SECONDS;
235 static const std::string STATISTICS_PERIOD_SECONDS_DEFAULT;
236
243 static constexpr const char* OPERATION_BACKUP_TIMEOUT_MILLIS =
244 "hazelcast.client.operation.backup.timeout.millis";
245 static constexpr const char* OPERATION_BACKUP_TIMEOUT_MILLIS_DEFAULT =
246 "5000";
247
256 static constexpr const char* FAIL_ON_INDETERMINATE_OPERATION_STATE =
257 "hazelcast.client.operation.fail.on.indeterminate.state";
258 static constexpr const char* FAIL_ON_INDETERMINATE_OPERATION_STATE_DEFAULT =
259 "false";
260
265 static constexpr const char* CLOUD_URL_BASE = "hazelcast.client.cloud.url";
266 static constexpr const char* CLOUD_URL_BASE_DEFAULT =
267 "api.viridian.hazelcast.com";
268
277 static constexpr const char* PARTITION_ARGUMENT_CACHE_SIZE =
278 "hazelcast.client.sql.partition.argument.cache.size";
279 static constexpr const char* PARTITION_ARGUMENT_CACHE_SIZE_DEFAULT = "1024";
280
287 bool get_boolean(const client_property& property) const;
288
295 int32_t get_integer(const client_property& property) const;
296
303 int64_t get_long(const client_property& property) const;
304
311 std::string get_string(const client_property& property) const;
312
313private:
314 client_property heartbeat_timeout_;
315 client_property heartbeat_interval_;
316 client_property retry_count_;
317 client_property retry_wait_time_;
318 client_property aws_member_port_;
319 client_property invocation_retry_pause_millis_;
320 client_property invocation_timeout_seconds_;
321 client_property event_thread_count_;
322 client_property internal_executor_pool_size_;
323 client_property shuffle_member_list_;
324 client_property max_concurrent_invocations_;
325 client_property backpressure_backoff_timeout_millis_;
326 client_property statistics_enabled_;
327 client_property statistics_period_seconds_;
328 client_property backup_timeout_millis_;
329 client_property fail_on_indeterminate_state_;
330 client_property cloud_base_url_;
331 client_property partition_arg_cache_size_;
332
333 std::unordered_map<std::string, std::string> properties_map_;
334};
335
336} // namespace client
337} // namespace hazelcast
338
339#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
340#pragma warning(pop)
341#endif
hazelcast_client configuration class.
static const std::string PROP_HEARTBEAT_INTERVAL
Time interval in milliseconds between the heartbeats sent by the client to the nodes.
static const std::string PROP_REQUEST_RETRY_COUNT
Client will retry requests which either inherently retryable(idempotentclient) or client_network_conf...
static const std::string PROP_REQUEST_RETRY_WAIT_TIME
Client will retry requests which either inherently retryable(idempotentclient) or client_network_conf...
static const std::string MAX_CONCURRENT_INVOCATIONS
The maximum number of concurrent invocations allowed.
static const std::string SHUFFLE_MEMBER_LIST
Client shuffles the given member list to prevent all clients to connect to the same node when this pr...
static const std::string STATISTICS_PERIOD_SECONDS
The period in seconds the statistics sent to the cluster.
static const std::string EVENT_THREAD_COUNT
Number of the threads to handle the incoming event packets.
static constexpr const char * PARTITION_ARGUMENT_CACHE_SIZE
Parametrized SQL queries touching only a single partition benefit from using the partition owner as t...
static const std::string STATISTICS_ENABLED
Use to enable the client statistics collection.
static const std::string INVOCATION_RETRY_PAUSE_MILLIS
Pause time between each retry cycle of an invocation in milliseconds.
static constexpr const char * FAIL_ON_INDETERMINATE_OPERATION_STATE
When this configuration is enabled, if an operation has sync backups and acks are not received from b...
static constexpr const char * OPERATION_BACKUP_TIMEOUT_MILLIS
If an operation has backups, this property specifies how long the invocation will wait for acks from ...
std::string get_string(const client_property &property) const
Returns the configured value of a ClientProperty as std::string.
int32_t get_integer(const client_property &property) const
Returns the configured int32_t value of a ClientProperty.
static const std::string PROP_AWS_MEMBER_PORT
The discovery mechanism will discover only IP addresses.
static const std::string PROP_HEARTBEAT_TIMEOUT
Client will be sending heartbeat messages to members and this is the timeout.
static const std::string INVOCATION_TIMEOUT_SECONDS
When an invocation gets an exception because :
bool get_boolean(const client_property &property) const
Returns the configured boolean value of a ClientProperty.
int64_t get_long(const client_property &property) const
Returns the configured int64_t value of a ClientProperty.
static const std::string BACKPRESSURE_BACKOFF_TIMEOUT_MILLIS
Control the maximum timeout in millis to wait for an invocation space to be available.
static constexpr const char * CLOUD_URL_BASE
Internal client property to change base url of cloud discovery endpoint.
A client property is a configuration for hazelcast client.
const char * get_system_property() const
Gets the system environment property value of the property.