24/27

# 18 Real Time Client—RTC

The Coherence Real Time Client provides secure and scalable access from client applications into a Coherence Data Grid. Coherence RTC extends the Data Grid to the desktop, providing the same core API as the rest of the Coherence product line.

Connectivity into the Coherence Data Grid is achieved through Coherence*Extend technology, which enables a client application to connect to a particular server within the Data Grid. Since the connections are load-balanced across all of the servers in the Data Grid, this approach to connectivity can scale to support tens of thousands of clients. See Configuring and Using Coherence*Extend for more information.

## Uses

The primary use for Coherence RTC is to provide clients with read-only/read-mostly access to data held in a Coherence cluster. Clients can query clustered caches and receive real-time updates as the data changes. Clients may also initiate server-side data manipulation tasks, including aggregations and processing. For more information on aggregations and processing, see the following API:

- Java: `com.tangosol.util.InvocableMap.EntryAggregator` and `com.tangosol.util.InvocableMap.EntryProcessor`

- C++: `coherence::util::InvocableMap::EntryAggregator` and `coherence::util::InvocableMap::EntryProcessor`

## Cache Access

Normally, client applications are granted only read access to the data being managed by the Data Grid (delegating cache updates to Data Grid Agents), although it is possible to enable direct read/write access.

## Local Caches

While the client application can directly access the caches managed by the Data Grid, that may be inefficient depending on the network infrastructure. For efficiency, the client application can use both Near Caching (Java, C++, or .NET) and Continuous Query Caching (Java, C++, or .NET) to maintain cache data locally.

For more information on near caching and continuous query, see:

- Java: "Near Cache", "Perform Continuous Query"

- C++: "Configuring a Near Cache for C++ Clients", "Perform Continuous Query for C++ Clients"

- .NET: "Configuring a Near Cache for .NET Clients", "Continuous Query Cache for .NET Clients"

## Event Notification

Using the standard Coherence event model, data changes that occur within the Data Grid are visible to the client application. Since the client application indicates the exact events that it is interested in, only those events are actually delivered over the wire, resulting in efficient use of network bandwidth and client processing.

For more information on the event model, see: "Using Cache Events" in Oracle Coherence Developer's Guide.

## Agent Invocation

Since the client application will likely only have read-only access, any manipulation of data is done within the Data Grid itself; the mechanism for this is the Data Grid Agent, which is presented by these API:.

- Java: `com.tangosol.util.InvocableMap`

- C++: `coherence::util::InvocableMap`

Clients may invoke tasks, aggregators and processors for server-side cached objects using the InvocableMap methods.

For more information on the Data Grid Agent, see Chapter 2, "Provide a Data Grid".

## Connection Failover

If the server to which the client application is attached happens to fail, the connection is automatically reestablished to another server, and then any locally cached data is re-synced with the cluster.