@ComponentProfile(summary="Check the cache for a key", tag="condition,cache", since="3.9.1", recommended=CacheConnection.class) public class ExistsInCache extends java.lang.Object implements Condition
Cache
In the adapter configuration file this class is aliased as exists-in-cache which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
ExistsInCache() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
boolean |
evaluate(AdaptrisMessage msg) |
AdaptrisConnection |
getConnection() |
java.lang.String |
getKey() |
void |
init()
Initialises the component.
|
void |
setConnection(AdaptrisConnection connection)
Set the connection to the
Cache instance. |
void |
setKey(java.lang.String key)
Specify the key to check for in the cache.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
ExistsInCache |
withConnection(AdaptrisConnection c) |
ExistsInCache |
withKey(java.lang.String key) |
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
close
in interface ComponentLifecycle
public boolean evaluate(AdaptrisMessage msg) throws CoreException
evaluate
in interface Condition
CoreException
public AdaptrisConnection getConnection()
public void setConnection(AdaptrisConnection connection)
Cache
instance.connection
- the connection.public java.lang.String getKey()
public void setKey(java.lang.String key)
key
- the key.public ExistsInCache withConnection(AdaptrisConnection c)
public ExistsInCache withKey(java.lang.String key)