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 voidclear()Delete all the Messages in the Message Storevoiddestroy()This method should implement the destroying of the implemented parts of the configuration.MessageContextget(int index)Return the Message in given index position (this may depend on the implementation)MessageContextget(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 queueMessageConsumergetConsumer()Returns a Message Consumer for this message store.MessageProducergetProducer()Returns a Message Producer for this message store.ObjectgetQLock()intgetType()Returns the type of this message store.voidinit(SynapseEnvironment se)This method should implement the initialization of the implemented parts of the configuration.MessageContextremove()Retrieves and removes the first Message in this store.MessageContextremove(String messageID)Delete and return the MessageContext with given Message idintsize()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:MessageStoreReturns 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:MessageStoreReturns 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: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- Overrides:
getTypein classAbstractMessageStore- Returns:
- Type of the message store.
-
size
public int size()
Description copied from interface:MessageStoreReturns the number of Messages in this store.- Specified by:
sizein interfaceMessageStore- Overrides:
sizein classAbstractMessageStore- Returns:
- the number of Messages in this Store
-
remove
public MessageContext remove() throws NoSuchElementException
Description copied from interface:MessageStoreRetrieves 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:MessageStoreDelete all the Messages in the Message Store
-
remove
public MessageContext remove(String messageID)
Description copied from interface:MessageStoreDelete 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:MessageStoreReturn 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:MessageStoreGet 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:MessageStoreGet 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:ManagedLifecycleThis method should implement the initialization of the implemented parts of the configuration.- Specified by:
initin interfaceManagedLifecycle- Overrides:
initin classAbstractMessageStore- Parameters:
se- SynapseEnvironment to be used for initialization
-
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- Overrides:
destroyin classAbstractMessageStore
-
getQLock
public Object getQLock()
-
-