-
Notifications
You must be signed in to change notification settings - Fork 1
MessageCache
Create a MessageCache to cache messages received via input queue, e.g. a multicast queue. Messages are cached by label, only the last message for a label is cached.
Properties:
-
CachePrefixthe prefix used to identify cache request messages, defaults tocache
Methods:
-
StartAsync()starts the cache -
StopAsync()stops the cache -
Dispose()also stops the cache
Applications often want the last known value for a multicast subject, e.g. the last known market price, or last held position, or current market exposure.
You can request the last message for a Label by sending a message to the input queue with the Label prefixed by cache. and the message ResponseQueue property set.
For example, to get the last message for label Price.123 send a message to the cache's input queue with:
-
Labelset tocache.Price.123 -
AppSpecificset toCacheAction.Read(0) -
ResponseQueueset to the format name of the queue to send a reply to
The cache will reply to the ResponseQueue with:
- all the fields of the last message for that subject,
Body,Extensionetc, or an empty message if no value is cached. -
CorrelationIdset to theIdof the request message
For example, to remove the last message for label Price.123 send a message to the cache's input queue with:
-
Labelset tocache.Price.123 -
AppSpecificset toCacheAction.Remove(5)
To list the keys in the cache send a message with:
-
Labelset tocache -
AppSpecificset toCacheAction.ListKeys(1) -
ResponseQueueset to the format name of the queue to send a reply to
The cache will reply to the ResponseQueue with a message with:
-
Bodyset a UTF-8 string containing multiple lines, one key per line. -
CorrelationIdset to theIdof the request message
To remove all entries from the cache send a message to the caches input queue with:
-
Labelset tocache -
AppSpecificset toCacheAction.Clear(9)