Contents

Producer Applications should be changed to use Last-value caching on a Topic. This section explains the procedure with an example. Consider a Topic named STOCK_UPDATES is configured with last-value caching enabled. The following properties are set on it:

  • EnableLastValueCache: true
  • CacheKeyPropertyName: (left as default LVCacheKey)
  • CachePropertyName: (left as default IsLVCache)

The MessageProducer that currently generates STOCK_UPDATE messages is modified as below to add two new properties to each JMS Message being placed on the Topic.

  1. Producer calls message.setStringProperty("LVCacheKey", "COM-1"); where "COM-1" is the identifier of the equity.
  2. Producer calls message.setBooleanProperty("IsLVCache", true); using true if the holding amount is > 0, or false otherwise.

The producer can implement the rule that if holding value is 0, the equity should no longer be considered part of the portfolio. If it is > 0, then the equity is part of the portfolio. With the pseudo-code above, the last-value cache on the Topic is added to (if "COM-1" is a new holding) or updated (if a previous holding has been adjusted). If the holding was 0, the producer would have set the IsLVCache property to false, thereby causing the broker to remove COM-1 from the Topic's last-value cache.

The code block in the MessageProducer looks like this to add or adjust an entry in the Topic's last-value cache:

Adaptavist ThemeBuilder EngineAtlassian Confluence