---
title:  Configuring a Durable Client
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->

The durable client can be configured in the `geode.properties` 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, <%=vars.product_name%> 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](<%=vars.serverman%>/developing/events/implementing_durable_client_server_messaging.html).

## Configuring a Durable Client Using geode.properties

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

``` pre
durable-client-id=31
durable-timeout=200
```

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

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

``` pre
// 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);
```
