Apache Geode Native C++ CHANGELOG

Configuring a Client Application

You can configure your native client application:

  • Programmatically in your app code
  • Via XML files and properties files (see Client Cache XML Reference)
  • Through a combination of programmatic and file-based approaches

This section describes configuration on two levels, the system level and the cache level. System property settings describe your application’s behavior, while cache configuration describes data.

Programmatic Configuration vs XML Configuration

Programmatic configuration enables your client application to dynamically adapt to changing runtime conditions.

In contrast, XML configuration externalizes properties, such as locator addresses and pool connection details, so they can be changed without requiring that you recompile your application.

C++ RegionFactory Example

The following examples illustrate how to set a region’s expiration timeout attribute programmatically and through XML.

Setting a property programmatically:

    auto regionFactory = cache.createRegionFactory(RegionShortcut::CACHING_PROXY);
    auto region = regionFactory.setRegionTimeToLive(ExpirationAction::INVALIDATE,
                    std::chrono::seconds(120))
         .create("exampleRegion0");

XML equivalent:

  <region name="exampleRegion0" refid="CACHING_PROXY">
    <region-attributes pool-name="default">
      <region-time-to-live>
        <expiration-attributes timeout="120s" action="invalidate"/>
      </region-time-to-live>
    </region-attributes>
  </region>

Tables of properties

See System Properties for a list of system properties that can be configured programmatically or in the geode.properties file.

High Availability with Server Redundancy

When redundancy is enabled, secondary servers maintain queue backups while the primary server pushes events to the client. If the primary server fails, one of the secondary servers steps in as primary to provide uninterrupted event messaging to the client. To configure high availability, set the subscription-redundancy in the client’s pool configuration. This setting indicates the number of secondary servers to use. See the Geode User Guide section Configuring Highly Available Servers for more details.