Related Documentation : Ehcache Replication Guide : Replicated Caching Using JMS : Ehcache Replication and External Publishers : External JMS Publishers
External JMS Publishers
Anything that can publish to a message queue can also add cache entries to ehcache. These are called non-cache publishers.
Required Message Properties
Publishers need to set up to four String properties on each message: cacheName, action, mimeType and key.
Property
Description
cacheName
A JMS message property which contains the name of the cache to operate on. If no cacheName is set the message will be <ignored>. A warning log message will indicate that the message has been ignored.
action
A JMS message property which contains the action to perform on the cache.
Available actions are strings labeled PUT, REMOVE and REMOVE_ALL.
If not set no action is performed. A warning log message will indicate that the message has been ignored.
mimeType
A JMS message property which contains the mimeType of the message. Applies to the PUT action. If not set the message is interpreted as follows:
*ObjectMessage - If it is an net.sf.ehcache.Element, then it is treated as such and stored in the cache. For other objects, a new Element is created using the object in the ObjectMessage as the value and the key property as a key. Because objects are already typed, the mimeType is ignored
*TextMessage - Stored in the cache as value of MimeTypeByteArray. The mimeType should be specified. If not specified it is stored as type text/plain.
*BytesMessage - Stored in the cache as value of MimeTypeByteArray. The mimeType should be specified. If not specified it is stored as type application/octet-stream.
Other message types are not supported.
To send XML use a TextMessage or BytesMessage and set the mimeType to application/xml. It will be stored in the cache as a value of MimeTypeByteArray.
The REMOVE and REMOVE_ALL actions do not require a mimeType property.
key
The key in the cache on which to operate on. The key is of type String.
The REMOVE_ALL action does not require a key property.
If an ObjectMessage of type net.sf.ehcache.Element is sent, the key is contained in the element. Any key set as a property is ignored.
If the key is required but not provided, a warning log message will indicate that the message has been ignored.
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback