Class JmsStore
- java.lang.Object
-
- org.apache.synapse.message.store.AbstractMessageStore
-
- org.apache.synapse.message.store.impl.jms.JmsStore
-
- All Implemented Interfaces:
ManagedLifecycle
,MessageStore
,Nameable
,SynapseArtifact
public class JmsStore extends AbstractMessageStore
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE
Whether to cache the connection or notstatic String
CONN_FACTORY
static String
CONNECTION_STRING
static String
CONSUMER_TIMEOUT
static String
DESTINATION
JMS destination (ie.static String
GUARANTEED_DELIVERY_ENABLE
Guaranteed delivery statusstatic String
JMS_SPEC_11
static String
JMS_VERSION
JMS Specification versionprotected static org.apache.commons.logging.Log
log
static String
NAMING_FACTORY_INITIAL
static String
PASSWORD
JMS Broker passwordstatic String
PROVIDER_URL
static String
QUEUE_PREFIX
JNDI Queue Prefixstatic String
USERNAME
JMS Broker username-
Fields inherited from class org.apache.synapse.message.store.AbstractMessageStore
description, fileName, lock, messageStoreMBean, messageStoreObservers, name, parameterKeyMap, parameters, sequence, synapseConfiguration
-
-
Constructor Summary
Constructors Constructor Description JmsStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup(javax.jms.Connection connection, javax.jms.Session session)
Cleans up the JMS Connection and Session associated with a JMS client.void
clear()
Delete all the Messages in the Message Storevoid
closeConnection(javax.jms.Connection connection)
Closes the given JMS Connection.void
closeWriteConnection()
Closes the existing JMS message producer connection.void
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.int
getType()
Returns the type of this message store.void
init(SynapseEnvironment se)
End of unsupported operations.org.apache.axis2.context.MessageContext
newAxis2Mc()
javax.jms.Connection
newConnection()
Creates a new JMS Connection.javax.jms.MessageConsumer
newConsumer(javax.jms.Session session)
Returns a new JMS Message Consumer.javax.jms.MessageProducer
newProducer(javax.jms.Session session)
Creates a new JMS Message Producer.javax.jms.Session
newSession(javax.jms.Connection connection, int mode, boolean isProducerSession)
Creates a new JMS Session.MessageContext
newSynapseMc(org.apache.axis2.context.MessageContext msgCtx)
void
newWriteConnection()
Creates a new JMS Message producer connection.javax.jms.Connection
producerConnection()
Returns the existing JMS message producer connection.MessageContext
remove()
JMS Message store does not support following operations.MessageContext
remove(String messageID)
Delete and return the MessageContext with given Message idvoid
reset(javax.jms.Connection connection, javax.jms.Session session)
Resets the JMS session for next messagevoid
setCachedProducer(MessageProducer cachedProducer)
void
setParameters(Map<String,Object> parameters)
set the implementation specific parametersvoid
setProducer(MessageProducer producer)
-
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, size, unregisterObserver
-
-
-
-
Field Detail
-
log
protected static final org.apache.commons.logging.Log log
-
USERNAME
public static final String USERNAME
JMS Broker username- See Also:
- Constant Field Values
-
PASSWORD
public static final String PASSWORD
JMS Broker password- See Also:
- Constant Field Values
-
CACHE
public static final String CACHE
Whether to cache the connection or not- See Also:
- Constant Field Values
-
DESTINATION
public static final String DESTINATION
JMS destination (ie. Queue) name that this message store must store the messages to.- See Also:
- Constant Field Values
-
JMS_VERSION
public static final String JMS_VERSION
JMS Specification version- See Also:
- Constant Field Values
-
CONSUMER_TIMEOUT
public static final String CONSUMER_TIMEOUT
- See Also:
- Constant Field Values
-
CONN_FACTORY
public static final String CONN_FACTORY
- See Also:
- Constant Field Values
-
NAMING_FACTORY_INITIAL
public static final String NAMING_FACTORY_INITIAL
- See Also:
- Constant Field Values
-
CONNECTION_STRING
public static final String CONNECTION_STRING
- See Also:
- Constant Field Values
-
PROVIDER_URL
public static final String PROVIDER_URL
- See Also:
- Constant Field Values
-
QUEUE_PREFIX
public static final String QUEUE_PREFIX
JNDI Queue Prefix- See Also:
- Constant Field Values
-
GUARANTEED_DELIVERY_ENABLE
public static final String GUARANTEED_DELIVERY_ENABLE
Guaranteed delivery status- See Also:
- Constant Field Values
-
JMS_SPEC_11
public static final String JMS_SPEC_11
- See Also:
- Constant Field Values
-
-
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() throws SynapseException
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.
- Throws:
SynapseException
-
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.
-
remove
public MessageContext remove() throws NoSuchElementException
JMS Message store does not support following operations.- 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)
End of unsupported operations.- Specified by:
init
in interfaceManagedLifecycle
- Overrides:
init
in classAbstractMessageStore
- Parameters:
se
- SynapseEnvironment to be used for initialization
-
destroy
public void destroy() throws SynapseException
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
- Throws:
SynapseException
-
newConnection
public javax.jms.Connection newConnection() throws javax.jms.JMSException, StoreForwardException
Creates a new JMS Connection.- Returns:
- A connection to the JMS Queue used as the store of this message store.
- Throws:
javax.jms.JMSException
- on a JMS issueStoreForwardException
- on a non JMS issue
-
newSession
public javax.jms.Session newSession(javax.jms.Connection connection, int mode, boolean isProducerSession) throws javax.jms.JMSException, StoreForwardException
Creates a new JMS Session.- Parameters:
connection
- The JMS Connection that must be used when creating the session.mode
- Acknowledgement mode that must be used for this session.isProducerSession
- Type of the session going to create- Returns:
- A JMS Session.
- Throws:
javax.jms.JMSException
- on a JMS related issueStoreForwardException
- on a non JMS related issue
-
newProducer
public javax.jms.MessageProducer newProducer(javax.jms.Session session) throws javax.jms.JMSException, StoreForwardException
Creates a new JMS Message Producer.- Parameters:
session
- A JMS Session.- Returns:
- A JMS Message Producer.
- Throws:
javax.jms.JMSException
StoreForwardException
-
newConsumer
public javax.jms.MessageConsumer newConsumer(javax.jms.Session session) throws javax.jms.JMSException, StoreForwardException
Returns a new JMS Message Consumer.- Parameters:
session
- JMS Session to create consumer form- Returns:
- JMS Message Consumer
- Throws:
javax.jms.JMSException
- on JMS issue when creating consumer with JMS providerStoreForwardException
-
newWriteConnection
public void newWriteConnection() throws StoreForwardException, javax.jms.JMSException
Creates a new JMS Message producer connection.- Throws:
StoreForwardException
- on a non JMS related issuejavax.jms.JMSException
- on a JMS issue
-
closeWriteConnection
public void closeWriteConnection() throws javax.jms.JMSException
Closes the existing JMS message producer connection.- Throws:
javax.jms.JMSException
- on a JMS level issue
-
producerConnection
public javax.jms.Connection producerConnection()
Returns the existing JMS message producer connection.- Returns:
- The current JMS Connection used to create message producers.
-
closeConnection
public void closeConnection(javax.jms.Connection connection) throws javax.jms.JMSException
Closes the given JMS Connection.- Parameters:
connection
- The JMS Connection to be closed.- Throws:
javax.jms.JMSException
- on a JMS level issue
-
reset
public void reset(javax.jms.Connection connection, javax.jms.Session session) throws javax.jms.JMSException
Resets the JMS session for next message- Parameters:
connection
- JMS Connectionsession
- JMS Session associated with the given connection- Throws:
javax.jms.JMSException
-
cleanup
public void cleanup(javax.jms.Connection connection, javax.jms.Session session) throws javax.jms.JMSException
Cleans up the JMS Connection and Session associated with a JMS client.- Parameters:
connection
- JMS Connectionsession
- JMS Session associated with the given connection- Throws:
javax.jms.JMSException
-
newAxis2Mc
public org.apache.axis2.context.MessageContext newAxis2Mc()
-
newSynapseMc
public MessageContext newSynapseMc(org.apache.axis2.context.MessageContext msgCtx)
-
setParameters
public void setParameters(Map<String,Object> parameters)
Description copied from interface:MessageStore
set the implementation specific parameters- Specified by:
setParameters
in interfaceMessageStore
- Overrides:
setParameters
in classAbstractMessageStore
- Parameters:
parameters
- A map of parameters or null
-
setCachedProducer
public void setCachedProducer(MessageProducer cachedProducer)
-
setProducer
public void setProducer(MessageProducer producer)
-
-