Universal Messaging 10.11 | Concepts | Commonly Used Features | Channel Publish Keys
 
Channel Publish Keys
Channels can be created with a set of Channel Publish Key objects, as well as the default attributes that define behaviour of a channel and the events on a channel.
Channel Keys allow a channel or queue to automatically purge old events when new events of the same "type" are received. Two events are of the same "type" if the value in their dictionary (nEventProperties) for the key defined as the Key Name are identical. The channel will store the specified number of most recent events whose values match the Key Name.
Channel Publish Keys enable the implementation of Last Value Caches. In a last value cache, only the most recent value for a given type of event is kept on the channel. In high-update situations, where only the most recent values are of interest, Channel Publish Keys can greatly improve efficiency in this way. By altering the depth associated with the channel publish key, a recent values cache (where a set number of the most recent events of the same type are stored) can also easily be implemented.
Using Channel Keys to Automatically Purge Redundant Data
For example, if you have a channel called BondDefinitions which should only contain the most recent event published for each Bond, you can enforce this automatically by using a channel key. This functionality vastly simplifies data publication, since the publisher will not have to check the value of data currently on the channel.
In the above example you would create a BondDefinition channel that has a Channel Key called BONDNAME with a depth of 1, as shown in the following Enterprise Manager screen shot:
The channel key defines the key in the nEventProperties which identifies events as being of the same type if their value for this key match. In order to add a Channel Key, type the name of the key into the Key Name box on the dialog and click Save. If you want the key to have a depth of greater than 1 then click the up arrow adjacent to the Depth field or enter the number manually.
If this is configured, as soon as an event is published to the BondDefinitions channel with a Dictionary entry called BONDNAME, the server checks to see if there is another event with the same value for that key. For example, if an event is published with a dictionary containing a key of BONDNAME and value of bondnameA and there is already an event with BONDNAME=bondnameA, then the old event will be removed, and the new one will take its place as the latest definition for bondnameA.
Another example would be if you wanted to keep the latest definition and the 2 before it, then you would create the channel key with depth 3 (implying that a maximum of 3 events with the same value for key name BONDNAME can exist on the channel).
If you wanted to keep an archive of all bondname values that were published to the channel, you could add a join from the BondDefinitions channel to, for example, a BondDefinitionsArchive channel. On this channel the absence of a Channel Key called BONDNAME will mean that it will store all events that have been published to the BondDefinitions channel.