Configuring a Durable Client

The durable client can be configured in the file, or in the CacheFactory::set(name, value) call.

  • Durable client ID—Indicate that the client is durable by giving it a durable-client-ID. The servers use this ID to identify the client. For a non-durable client, the durable-client-ID is an empty string. The ID can be any number that is unique among the clients attached to servers in the same distributed system.

  • Durable timeout—The durable-timeout setting specifies how long this client’s servers should wait after the client disconnects before terminating its message queue. During that time, the servers consider the client alive and continue to accumulate messages for it. The default is 300 seconds.

The durable-timeout setting is a tuning parameter. When setting the timeout, take into account the normal activity of your application, the average size of your messages, and the level of risk you can handle. Assuming that no messages are being removed from the queue, how long can the application run before the queue reaches the maximum message count? In addition, how long can it run before the queued messages consume all the memory on the client host? How serious is each of those failures to your operation?

To assist with tuning, GemFire statistics track message queues for durable clients through the disconnect and reconnect cycles.

When the queue is full, it blocks further operations that add messages until the queue size drops to an acceptable level. Server configuration sets the action to take. See details on server configuration of the queue in the server documentation section Implementing Durable Client/Server Messaging.

Configuring a Durable Client Using

The following example shows settings to make the client durable and set the durable timeout to 200 seconds.


Configuring a Durable Client Through the API (C++)

This programmatic example creates a durable client using the CacheFactory::set(name, value).

// Create durable client's properties using the C++ api
PropertiesPtr pp = Properties::create();
pp->insert("durable-client-id", "DurableClientId");
pp->insert("durable-timeout", std::chrono::seconds(200));
cacheFactoryPtr = CacheFactory::createCacheFactory(pp);