Class 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 CacheServiceBase
Service implementation that adds entries to a cache based on its configured CacheEntryEvaluators.

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 RetrieveFromCacheService or RemoveFromCacheService to subsequently retrieve those values from the cache.

See Also:

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.

  • Constructor Details

    • AddToCacheService

      public AddToCacheService()
  • Method Details

    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Description copied from interface: Service

      Apply the service to the message.

      Parameters:
      msg - the AdaptrisMessage to process
      Throws:
      ServiceException - wrapping any underlying Exceptions
    • setEnforceSerializable

      public void setEnforceSerializable(Boolean bool)
      If this is set to true then the service will only attempt to cache values that are Serializable.

      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 Boolean getEnforceSerializable()
    • enforceSerializable

      public boolean enforceSerializable()