Class InMemoryStore
- java.lang.Object
-
- org.apache.synapse.message.store.AbstractMessageStore
-
- org.apache.synapse.message.store.impl.memory.InMemoryStore
-
- All Implemented Interfaces:
ManagedLifecycle
,MessageStore
,Nameable
,SynapseArtifact
public class InMemoryStore extends AbstractMessageStore
-
-
Field Summary
-
Fields inherited from class org.apache.synapse.message.store.AbstractMessageStore
description, fileName, lock, messageStoreMBean, messageStoreObservers, name, parameterKeyMap, parameters, sequence, synapseConfiguration, synapseEnvironment
-
-
Constructor Summary
Constructors Constructor Description InMemoryStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Delete all the Messages in the Message Storevoid
destroy()
This method should implement the destroying of the implemented parts of the configuration.MessageContext
get(int index)
Return the Message in given index position (this may depend on the implementation)MessageContext
get(String messageId)
Get the Message with the given ID from the Message store without removing itList<MessageContext>
getAll()
Get the All messages in the Message store without removing them from the queueMessageConsumer
getConsumer()
Returns a Message Consumer for this message store.MessageProducer
getProducer()
Returns a Message Producer for this message store.Object
getQLock()
int
getType()
Returns the type of this message store.void
init(SynapseEnvironment se)
This method should implement the initialization of the implemented parts of the configuration.MessageContext
remove()
Retrieves and removes the first Message in this store.MessageContext
remove(String messageID)
Delete and return the MessageContext with given Message idint
size()
Returns the number of Messages in this store.-
Methods inherited from class org.apache.synapse.message.store.AbstractMessageStore
addParameter, addParameterKey, dequeued, difference, enqueued, getArtifactContainerName, getDescription, getFileName, getLock, getName, getParameterKey, getParameterKeyMap, getParameters, isEdited, nextConsumerId, nextProducerId, notifyMessageAddition, notifyMessageRemoval, registerObserver, setArtifactContainerName, setDescription, setFileName, setIsEdited, setName, setParameters, unregisterObserver
-
-
-
-
Method Detail
-
getProducer
public MessageProducer getProducer()
Description copied from interface:MessageStore
Returns a Message Producer for this message store.- Returns:
- A non-null message producer that can produce messages to this message store.
-
getConsumer
public MessageConsumer getConsumer()
Description copied from interface:MessageStore
Returns a Message Consumer for this message store.- Returns:
- A non-null message consumer that can read messages from this message store.
-
getType
public int getType()
Description copied from interface:MessageStore
Returns 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:
getType
in interfaceMessageStore
- Overrides:
getType
in classAbstractMessageStore
- Returns:
- Type of the message store.
-
size
public int size()
Description copied from interface:MessageStore
Returns the number of Messages in this store.- Specified by:
size
in interfaceMessageStore
- Overrides:
size
in classAbstractMessageStore
- Returns:
- the number of Messages in this Store
-
remove
public MessageContext remove() throws NoSuchElementException
Description copied from interface:MessageStore
Retrieves and removes the first Message in this store. Message ordering will depend on the underlying implementation- Returns:
- first message context in the store
- Throws:
NoSuchElementException
- if store is empty
-
clear
public void clear()
Description copied from interface:MessageStore
Delete all the Messages in the Message Store
-
remove
public MessageContext remove(String messageID)
Description copied from interface:MessageStore
Delete and return the MessageContext with given Message id- Parameters:
messageID
- message id of the Message- Returns:
- MessageContext instance
-
get
public MessageContext get(int index)
Description copied from interface:MessageStore
Return the Message in given index position (this may depend on the implementation)- Parameters:
index
- position of the message- Returns:
- Message in given index position
-
getAll
public List<MessageContext> getAll()
Description copied from interface:MessageStore
Get the All messages in the Message store without removing them from the queue- Returns:
- List of all Messages
-
get
public MessageContext get(String messageId)
Description copied from interface:MessageStore
Get the Message with the given ID from the Message store without removing it- Parameters:
messageId
- A message ID string- Returns:
- Message with given ID
-
init
public void init(SynapseEnvironment se)
Description copied from interface:ManagedLifecycle
This method should implement the initialization of the implemented parts of the configuration.- Specified by:
init
in interfaceManagedLifecycle
- Overrides:
init
in classAbstractMessageStore
- Parameters:
se
- SynapseEnvironment to be used for initialization
-
destroy
public void destroy()
Description copied from interface:ManagedLifecycle
This method should implement the destroying of the implemented parts of the configuration.- Specified by:
destroy
in interfaceManagedLifecycle
- Overrides:
destroy
in classAbstractMessageStore
-
getQLock
public Object getQLock()
-
-