org.apache.synapse.message.store
Class InMemoryMessageStore

java.lang.Object
  extended by org.apache.synapse.message.store.AbstractMessageStore
      extended by org.apache.synapse.message.store.InMemoryMessageStore
All Implemented Interfaces:
ManagedLifecycle, MessageStore, Nameable, SynapseArtifact

public class InMemoryMessageStore
extends AbstractMessageStore

InMemory Message store will store Failed Messages in the local memory


Field Summary
 
Fields inherited from class org.apache.synapse.message.store.AbstractMessageStore
description, fileName, messageStoreMBean, messageStoreObservers, name, parameters, sequence, synapseConfiguration, synapseEnvironment
 
Constructor Summary
InMemoryMessageStore()
           
 
Method Summary
 void clear()
          Delete all the Messages in the Message Store
 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 it
 List<MessageContext> getAll()
          Get the All messages in the Message store without removing them from the queue
 boolean offer(MessageContext messageContext)
          Inserts the Message into this store if it is possible to do so immediately without violating capacity restrictions.
 MessageContext peek()
          Retrieves but not removes the first Message in this store.
 MessageContext poll()
          Retrieves and removes the first Message in this store.
 MessageContext remove()
          Retrieves and removes the first Message in this store.
 MessageContext remove(String messageID)
          Delete and return the MessageContext with given Message id
 int size()
          Returns the number of Messages in this store.
 
Methods inherited from class org.apache.synapse.message.store.AbstractMessageStore
destroy, getDescription, getFileName, getLock, getName, getParameters, init, notifyMessageAddition, notifyMessageRemoval, registerObserver, setDescription, setFileName, setName, setParameters, unregisterObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryMessageStore

public InMemoryMessageStore()
Method Detail

offer

public boolean offer(MessageContext messageContext)
Description copied from interface: MessageStore
Inserts the Message into this store if it is possible to do so immediately without violating capacity restrictions.

Parameters:
messageContext - MessageContext to be saved

poll

public MessageContext poll()
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

peek

public MessageContext peek()
Description copied from interface: MessageStore
Retrieves but not removes the first Message in this store. Message ordering will depend on the underlying implementation

Returns:
first message context in the 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

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

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

clear

public void clear()
Description copied from interface: MessageStore
Delete all the Messages in the Message Store


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

size

public int size()
Description copied from interface: MessageStore
Returns the number of Messages in this store.

Specified by:
size in interface MessageStore
Overrides:
size in class AbstractMessageStore
Returns:
the number of Messages in this Store


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.