You can receive events from your servers for server-side cache events and query result changes.
For cache updates, you can configure to receive entry keys and values or just entry keys, with the data retrieved lazily when requested. The queries are run continuously against server cache events, with the server sending the deltas for your query result sets.
Before you begin, set up your client/server installation and configure and program your basic event messaging.
Servers receive updates for all entry events in their client’s client regions.
To receive entry events in the client from the server:
subscription-enabledto true. See <pool>.
Program the client to register interest in the entries you need.
Note: This must be done through the API.
Register interest in all keys, a key list, individual keys, or by comparing key strings to regular expressions. By default, no entries are registered to receive updates. Specify whether the server is to send values with entry update events. Interest registration is only available through the API.
Use the region’s
registerInterest* methods to specify the entries you want. Examples:
// Register interest in a single key and download its entry // at this time, if it is available in the server cache Region region1 = . . . ; region1.registerInterest("key-1"); // Register Interest in a List of Keys but do not do an initial bulk load // do not send values for creater/update events - just send key with invalidation Region region2 = . . . ; List list = new ArrayList(); list.add("key-1"); list.add("key-2"); list.add("key-3"); list.add("key-4"); region2.registerInterestForKeys(list, InterestResultPolicy.NONE, false); // Register interest in all keys and download all available keys now Region region3 = . . . ; region3.registerInterestForAllKeys(InterestResultPolicy.KEYS); // Register Interest in all keys matching a regular expression Region region1 = . . . ; region1.registerInterestRegex("[a-zA-Z]+_[0-9]+");
You can call the register interest methods multiple times for a single region. Each interest registration adds to the server’s list of registered interest criteria for the client. So if a client registers interest in key ‘A’, then registers interest in regular expression “B*”, the server will send updates for all entries with key ‘A’ or key beginning with the letter ‘B’.
For highly available event messaging, configure server redundancy. See Configuring Highly Available Servers.