Class AddToCacheService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.cache.CacheServiceImpl
-
- com.adaptris.core.services.cache.CacheServiceBase
-
- com.adaptris.core.services.cache.AddToCacheService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ConnectedService,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Add values to a cache", tag="service,cache", recommended=CacheConnection.class) public class AddToCacheService extends CacheServiceBaseServiceimplementation that adds entries to a cache based on its configuredCacheEntryEvaluators.The standard use case for this is if you wish to cache certain information across workflows (e.g. a CorrelationId). In your source workflow you would use this service to add your required value into the cache. Subsequent workflows could then use
RetrieveFromCacheServiceorRemoveFromCacheServiceto subsequently retrieve those values from the cache.- See Also:
Cache,RemoveFromCacheService,RetrieveFromCacheService
In the adapter configuration file this class is aliased as add-to-cache which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description AddToCacheService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoService(AdaptrisMessage msg)Apply the service to the message.booleanenforceSerializable()java.lang.BooleangetEnforceSerializable()voidsetEnforceSerializable(java.lang.Boolean bool)If this is set to true then the service will only attempt to cache values that areSerializable.-
Methods inherited from class com.adaptris.core.services.cache.CacheServiceBase
addCacheEntryEvaluator, addCacheValueToMessage, getCacheEntryEvaluators, setCacheEntryEvaluators
-
Methods inherited from class com.adaptris.core.services.cache.CacheServiceImpl
closeService, getConnection, initService, prepare, retrieveCache, setConnection, start, stop, withConnection
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions
-
setEnforceSerializable
public void setEnforceSerializable(java.lang.Boolean bool)
If this is set to true then the service will only attempt to cache values that areSerializable.An exception will be thrown if any non-serializable object is attempted to be cached. This is to enable non-memory based caching engines to be used (where serialization may be used to store the value)
- Parameters:
bool- default is false.
-
getEnforceSerializable
public java.lang.Boolean getEnforceSerializable()
-
enforceSerializable
public boolean enforceSerializable()
-
-