Package org.apache.synapse.message.store
Class AbstractMessageStore
- java.lang.Object
-
- org.apache.synapse.message.store.AbstractMessageStore
-
- All Implemented Interfaces:
ManagedLifecycle,MessageStore,Nameable,SynapseArtifact
- Direct Known Subclasses:
InMemoryStore,JDBCMessageStore,JmsStore,RabbitMQStore
public abstract class AbstractMessageStore extends Object implements MessageStore
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdescriptionMessage Store descriptionprotected StringfileNameName of the file where this message store is definedprotected Locklockprotected MessageStoreViewmessageStoreMBeanMessage store JMX viewprotected List<MessageStoreObserver>messageStoreObserversList that holds the MessageStore observers registered with the Message Storeprotected Stringnamemessage store nameprotected Map<String,String>parameterKeyMapMessage store parameters with registry keysprotected Map<String,Object>parametersMessage store parametersprotected Stringsequencename of the sequence to be executed before storing the messageprotected SynapseConfigurationsynapseConfigurationsynapse configuration referenceprotected SynapseEnvironmentsynapseEnvironmentsynapse environment reference
-
Constructor Summary
Constructors Constructor Description AbstractMessageStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(String name, String key)Adds message store specific parametersvoidaddParameterKey(String name, String key)Adds message store parameter registry keysvoiddequeued()voiddestroy()This method should implement the destroying of the implemented parts of the configuration.longdifference()voidenqueued()StringgetArtifactContainerName()Get the name of the artifact container from which the message store deployedStringgetDescription()Retrieves the description of the artifactStringgetFileName()get the file name that the message store is configuredLockgetLock()StringgetName()Get the name of an abstractionStringgetParameterKey(String name)Gets parameter registry key from the parameter nameMap<String,String>getParameterKeyMap()Gets registry key mappings for the parametersMap<String,Object>getParameters()get the implementation specific parameters of the Message storeintgetType()Returns the type of this message store.voidinit(SynapseEnvironment se)This method should implement the initialization of the implemented parts of the configuration.booleanisEdited()Whether the message store edited through the management consoleintnextConsumerId()intnextProducerId()protected voidnotifyMessageAddition(String messageId)Notify Message Addition to the observersprotected voidnotifyMessageRemoval(String messageId)Notify Message removal to the observersvoidregisterObserver(MessageStoreObserver observer)voidsetArtifactContainerName(String artifactContainerName)Set the name of the artifact container from which the message store deployedvoidsetDescription(String description)Set the description of the artifactvoidsetFileName(String filename)Set the name of the file that the Message store is configuredvoidsetIsEdited(boolean isEdited)Set whether the message store edited through the management consolevoidsetName(String name)Set the name of an abstractionvoidsetParameters(Map<String,Object> parameters)set the implementation specific parametersintsize()Returns the number of Messages in this store.voidunregisterObserver(MessageStoreObserver observer)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.synapse.message.store.MessageStore
clear, get, get, getAll, getConsumer, getProducer, remove, remove
-
-
-
-
Field Detail
-
name
protected String name
message store name
-
sequence
protected String sequence
name of the sequence to be executed before storing the message
-
messageStoreMBean
protected MessageStoreView messageStoreMBean
Message store JMX view
-
synapseConfiguration
protected SynapseConfiguration synapseConfiguration
synapse configuration reference
-
synapseEnvironment
protected SynapseEnvironment synapseEnvironment
synapse environment reference
-
parameterKeyMap
protected Map<String,String> parameterKeyMap
Message store parameters with registry keys
-
description
protected String description
Message Store description
-
fileName
protected String fileName
Name of the file where this message store is defined
-
messageStoreObservers
protected List<MessageStoreObserver> messageStoreObservers
List that holds the MessageStore observers registered with the Message Store
-
lock
protected Lock lock
-
-
Method Detail
-
init
public void init(SynapseEnvironment se)
Description copied from interface:ManagedLifecycleThis method should implement the initialization of the implemented parts of the configuration.- Specified by:
initin interfaceManagedLifecycle- Parameters:
se- SynapseEnvironment to be used for initialization
-
getName
public String getName()
Description copied from interface:NameableGet the name of an abstraction
-
setName
public void setName(String name)
Description copied from interface:NameableSet the name of an abstraction
-
registerObserver
public void registerObserver(MessageStoreObserver observer)
-
unregisterObserver
public void unregisterObserver(MessageStoreObserver observer)
-
notifyMessageAddition
protected void notifyMessageAddition(String messageId)
Notify Message Addition to the observers- Parameters:
messageId- of the Message added.
-
notifyMessageRemoval
protected void notifyMessageRemoval(String messageId)
Notify Message removal to the observers- Parameters:
messageId- of the Message added
-
size
public int size()
Description copied from interface:MessageStoreReturns the number of Messages in this store.- Specified by:
sizein interfaceMessageStore- Returns:
- the number of Messages in this Store
-
getParameters
public Map<String,Object> getParameters()
Description copied from interface:MessageStoreget the implementation specific parameters of the Message store- Specified by:
getParametersin interfaceMessageStore- Returns:
- a properties map
-
setParameters
public void setParameters(Map<String,Object> parameters)
Description copied from interface:MessageStoreset the implementation specific parameters- Specified by:
setParametersin interfaceMessageStore- Parameters:
parameters- A map of parameters or null
-
addParameter
public void addParameter(String name, String key)
Description copied from interface:MessageStoreAdds message store specific parameters- Specified by:
addParameterin interfaceMessageStore- Parameters:
name- parameter namekey- parameter key value
-
addParameterKey
public void addParameterKey(String name, String key)
Description copied from interface:MessageStoreAdds message store parameter registry keys- Specified by:
addParameterKeyin interfaceMessageStore- Parameters:
name- parameter namekey- parameter registry key value
-
getParameterKey
public String getParameterKey(String name)
Description copied from interface:MessageStoreGets parameter registry key from the parameter name- Specified by:
getParameterKeyin interfaceMessageStore- Parameters:
name- parameter name- Returns:
- registry key of parameter value
-
getParameterKeyMap
public Map<String,String> getParameterKeyMap()
Description copied from interface:MessageStoreGets registry key mappings for the parameters- Specified by:
getParameterKeyMapin interfaceMessageStore- Returns:
- registry key maps for parameter values
-
destroy
public void destroy()
Description copied from interface:ManagedLifecycleThis method should implement the destroying of the implemented parts of the configuration.- Specified by:
destroyin interfaceManagedLifecycle
-
setDescription
public void setDescription(String description)
Description copied from interface:SynapseArtifactSet the description of the artifact- Specified by:
setDescriptionin interfaceSynapseArtifact- Parameters:
description- tobe set to the artifact
-
getDescription
public String getDescription()
Description copied from interface:SynapseArtifactRetrieves the description of the artifact- Specified by:
getDescriptionin interfaceSynapseArtifact- Returns:
- description of the artifact
-
setFileName
public void setFileName(String filename)
Description copied from interface:MessageStoreSet the name of the file that the Message store is configured- Specified by:
setFileNamein interfaceMessageStore- Parameters:
filename- Name of the file where this artifact is defined
-
getFileName
public String getFileName()
Description copied from interface:MessageStoreget the file name that the message store is configured- Specified by:
getFileNamein interfaceMessageStore- Returns:
- Name of the file where this artifact is defined
-
getType
public int getType()
Description copied from interface:MessageStoreReturns the type of this message store.
The type of a message store can be one of following types,
Constants.JMS_MS,Constants.INMEMORY_MS, orConstants.JDBC_MS- Specified by:
getTypein interfaceMessageStore- Returns:
- Type of the message store.
-
getLock
public Lock getLock()
-
nextProducerId
public int nextProducerId()
-
nextConsumerId
public int nextConsumerId()
-
enqueued
public void enqueued()
-
dequeued
public void dequeued()
-
difference
public long difference()
-
isEdited
public boolean isEdited()
Whether the message store edited through the management console- Specified by:
isEditedin interfaceMessageStore- Returns:
- isEdited
-
setIsEdited
public void setIsEdited(boolean isEdited)
Set whether the message store edited through the management console- Specified by:
setIsEditedin interfaceMessageStore- Parameters:
isEdited-
-
getArtifactContainerName
public String getArtifactContainerName()
Get the name of the artifact container from which the message store deployed- Specified by:
getArtifactContainerNamein interfaceMessageStore- Returns:
- artifactContainerName
-
setArtifactContainerName
public void setArtifactContainerName(String artifactContainerName)
Set the name of the artifact container from which the message store deployed- Specified by:
setArtifactContainerNamein interfaceMessageStore- Parameters:
artifactContainerName-
-
-