org.apache.synapse.message.store
Interface MessageStore

All Superinterfaces:
ManagedLifecycle, Nameable, SynapseArtifact
All Known Implementing Classes:
AbstractMessageStore, InMemoryMessageStore

public interface MessageStore
extends SynapseArtifact, Nameable, ManagedLifecycle

This is the interface for the Synapse Message Store Message Store is used to store Messages.


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
 String getFileName()
          get the file name that the message store is configured
 Map<String,Object> getParameters()
          get the implementation specific parameters of the Message store
 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.
 void registerObserver(MessageStoreObserver observer)
          Register a MessageStore observer instance with the MessageStore to receive events.
 MessageContext remove()
          Retrieves and removes the first Message in this store.
 MessageContext remove(String messageID)
          Delete and return the MessageContext with given Message id
 void setFileName(String filename)
          Set the name of the file that the Message store is configured
 void setParameters(Map<String,Object> parameters)
          set the implementation specific parameters
 int size()
          Returns the number of Messages in this store.
 void unregisterObserver(MessageStoreObserver observer)
          Un register an Message store instance from the message store to stop receiving events
 
Methods inherited from interface org.apache.synapse.SynapseArtifact
getDescription, setDescription
 
Methods inherited from interface org.apache.synapse.Nameable
getName, setName
 
Methods inherited from interface org.apache.synapse.ManagedLifecycle
destroy, init
 

Method Detail

offer

boolean offer(MessageContext messageContext)
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

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

MessageContext peek()
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

MessageContext remove()
                      throws NoSuchElementException
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

void clear()
Delete all the Messages in the Message Store


remove

MessageContext remove(String messageID)
Delete and return the MessageContext with given Message id

Parameters:
messageID - message id of the Message
Returns:
MessageContext instance

size

int size()
Returns the number of Messages in this store.

Returns:
the number of Messages in this Store

get

MessageContext get(int index)
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

List<MessageContext> getAll()
Get the All messages in the Message store without removing them from the queue

Returns:
List of all Messages

get

MessageContext get(String messageId)
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

setParameters

void setParameters(Map<String,Object> parameters)
set the implementation specific parameters

Parameters:
parameters - A map of parameters or null

getParameters

Map<String,Object> getParameters()
get the implementation specific parameters of the Message store

Returns:
a properties map

setFileName

void setFileName(String filename)
Set the name of the file that the Message store is configured

Parameters:
filename - Name of the file where this artifact is defined

getFileName

String getFileName()
get the file name that the message store is configured

Returns:
Name of the file where this artifact is defined

registerObserver

void registerObserver(MessageStoreObserver observer)
Register a MessageStore observer instance with the MessageStore to receive events.

Parameters:
observer - instance to be registered

unregisterObserver

void unregisterObserver(MessageStoreObserver observer)
Un register an Message store instance from the message store to stop receiving events

Parameters:
observer - instance to be unregistered


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