public abstract class AbstractCachingStrategy extends org.mule.runtime.api.component.AbstractComponent implements CachingStrategy, org.mule.runtime.core.api.context.MuleContextAware, org.mule.runtime.api.lifecycle.Lifecycle
CachingStrategy template. Implementations must provide a way to store an retrieve cached objects. Object's
keys are generated using a MuleEventKeyGenerator and the responses are generated using a ResponseGenerator.
Cached object can be copied using a MuleEventCopier. The caching strategy will only cache the CoreEvent that
have a non consumable message's payload.| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
AbstractCachingStrategy() |
| Modifier and Type | Method and Description |
|---|---|
MuleEventKeyGenerator |
getKeyGenerator() |
protected Lock |
getLock(Serializable key) |
org.mule.runtime.api.lock.LockFactory |
getLockFactory() |
protected org.mule.runtime.api.scheduler.Scheduler |
getLockScheduler() |
MuleEventCopier |
getMuleEventCopier() |
String |
getName() |
ResponseGenerator |
getResponseGenerator() |
boolean |
isSynchronizedAccess() |
org.mule.runtime.core.api.event.CoreEvent |
process(org.mule.runtime.core.api.event.CoreEvent event,
org.mule.runtime.core.api.processor.Processor messageProcessor)
Processes a
CoreEvent using a caching schema. |
protected abstract org.mule.runtime.core.api.event.CoreEvent |
retrieve(String key) |
void |
setKeyGenerator(MuleEventKeyGenerator keyGenerator) |
void |
setLockFactory(org.mule.runtime.api.lock.LockFactory lockFactory) |
void |
setMuleContext(org.mule.runtime.core.api.MuleContext context) |
void |
setMuleEventCopier(MuleEventCopier muleEventCopier) |
void |
setName(String name) |
void |
setResponseGenerator(ResponseGenerator responseGenerator) |
void |
setSchedulerService(org.mule.runtime.api.scheduler.SchedulerService schedulerService) |
void |
setSynchronizedAccess(boolean synchronizedAccess) |
void |
start() |
void |
stop() |
protected abstract void |
store(String key,
org.mule.runtime.core.api.event.CoreEvent value) |
org.mule.runtime.core.api.processor.ReactiveProcessor |
transformProcessor(org.mule.runtime.core.api.processor.Processor processor)
Obtain the publisher function for caching strategy given a processor
|
getAnnotation, getAnnotations, getLocation, getRootContainerLocation, initRootContainerName, setAnnotationspublic void start()
throws org.mule.runtime.api.exception.MuleException
start in interface org.mule.runtime.api.lifecycle.Startableorg.mule.runtime.api.exception.MuleExceptionpublic void stop()
throws org.mule.runtime.api.exception.MuleException
stop in interface org.mule.runtime.api.lifecycle.Stoppableorg.mule.runtime.api.exception.MuleExceptionpublic org.mule.runtime.core.api.event.CoreEvent process(org.mule.runtime.core.api.event.CoreEvent event,
org.mule.runtime.core.api.processor.Processor messageProcessor)
throws org.mule.runtime.api.exception.MuleException
CachingStrategyCoreEvent using a caching schema. Uses a message processor to process the request when it is not found in the
cache or when it must be processed without using the cache.
Different calls to this method using the same request does not implies that the same instance will be returned. Each
implementation could choose to create new instances every time.process in interface CachingStrategyevent - the event to processmessageProcessor - the message processor that will be executed when the response for the event is not in the cache.org.mule.runtime.api.exception.MuleExceptionpublic org.mule.runtime.core.api.processor.ReactiveProcessor transformProcessor(org.mule.runtime.core.api.processor.Processor processor)
CachingStrategytransformProcessor in interface CachingStrategyprocessor - the processor that will be executed when the response for the event is not in the cache.protected Lock getLock(Serializable key)
protected abstract void store(String key, org.mule.runtime.core.api.event.CoreEvent value)
protected abstract org.mule.runtime.core.api.event.CoreEvent retrieve(String key)
public MuleEventKeyGenerator getKeyGenerator()
public void setKeyGenerator(MuleEventKeyGenerator keyGenerator)
public ResponseGenerator getResponseGenerator()
public void setResponseGenerator(ResponseGenerator responseGenerator)
public String getName()
public void setName(String name)
public MuleEventCopier getMuleEventCopier()
public void setMuleEventCopier(MuleEventCopier muleEventCopier)
public void setSynchronizedAccess(boolean synchronizedAccess)
public boolean isSynchronizedAccess()
public org.mule.runtime.api.lock.LockFactory getLockFactory()
@Inject public void setLockFactory(org.mule.runtime.api.lock.LockFactory lockFactory)
public void setMuleContext(org.mule.runtime.core.api.MuleContext context)
setMuleContext in interface org.mule.runtime.core.api.context.MuleContextAwarepublic void setSchedulerService(org.mule.runtime.api.scheduler.SchedulerService schedulerService)
protected org.mule.runtime.api.scheduler.Scheduler getLockScheduler()
Copyright © 2006–2019 MuleSoft, Inc.. All rights reserved.