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 StringCACHEWhether to cache the connection or notstatic StringCONN_FACTORYstatic StringCONNECTION_STRINGstatic StringCONSUMER_TIMEOUTstatic StringDESTINATIONJMS destination (ie.static StringGUARANTEED_DELIVERY_ENABLEGuaranteed delivery statusstatic StringJMS_SPEC_11static StringJMS_VERSIONJMS Specification versionprotected static org.apache.commons.logging.Loglogstatic StringNAMING_FACTORY_INITIALstatic StringPASSWORDJMS Broker passwordstatic StringPROVIDER_URLstatic StringQUEUE_PREFIXJNDI Queue Prefixstatic StringUSERNAMEJMS 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 voidcleanup(javax.jms.Connection connection, javax.jms.Session session)Cleans up the JMS Connection and Session associated with a JMS client.voidclear()Delete all the Messages in the Message StorevoidcloseConnection(javax.jms.Connection connection)Closes the given JMS Connection.voidcloseWriteConnection()Closes the existing JMS message producer connection.voiddestroy()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.intgetType()Returns the type of this message store.voidinit(SynapseEnvironment se)End of unsupported operations.org.apache.axis2.context.MessageContextnewAxis2Mc()javax.jms.ConnectionnewConnection()Creates a new JMS Connection.javax.jms.MessageConsumernewConsumer(javax.jms.Session session)Returns a new JMS Message Consumer.javax.jms.MessageProducernewProducer(javax.jms.Session session)Creates a new JMS Message Producer.javax.jms.SessionnewSession(javax.jms.Connection connection, int mode, boolean isProducerSession)Creates a new JMS Session.MessageContextnewSynapseMc(org.apache.axis2.context.MessageContext msgCtx)voidnewWriteConnection()Creates a new JMS Message producer connection.javax.jms.ConnectionproducerConnection()Returns the existing JMS message producer connection.MessageContextremove()JMS Message store does not support following operations.MessageContextremove(String messageID)Delete and return the MessageContext with given Message idvoidreset(javax.jms.Connection connection, javax.jms.Session session)Resets the JMS session for next messagevoidsetCachedProducer(MessageProducer cachedProducer)voidsetParameters(Map<String,Object> parameters)set the implementation specific parametersvoidsetProducer(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: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() throws SynapseException
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.
- Throws:
SynapseException
-
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.
-
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: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)
End of unsupported operations.- Specified by:
initin interfaceManagedLifecycle- Overrides:
initin classAbstractMessageStore- Parameters:
se- SynapseEnvironment to be used for initialization
-
destroy
public void destroy() throws SynapseExceptionDescription copied from interface:ManagedLifecycleThis method should implement the destroying of the implemented parts of the configuration.- Specified by:
destroyin interfaceManagedLifecycle- Overrides:
destroyin classAbstractMessageStore- Throws:
SynapseException
-
newConnection
public javax.jms.Connection newConnection() throws javax.jms.JMSException, StoreForwardExceptionCreates 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, StoreForwardExceptionCreates 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, StoreForwardExceptionCreates a new JMS Message Producer.- Parameters:
session- A JMS Session.- Returns:
- A JMS Message Producer.
- Throws:
javax.jms.JMSExceptionStoreForwardException
-
newConsumer
public javax.jms.MessageConsumer newConsumer(javax.jms.Session session) throws javax.jms.JMSException, StoreForwardExceptionReturns 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.JMSExceptionCreates 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.JMSExceptionCloses 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.JMSExceptionCloses 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.JMSExceptionResets 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.JMSExceptionCleans 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:MessageStoreset the implementation specific parameters- Specified by:
setParametersin interfaceMessageStore- Overrides:
setParametersin classAbstractMessageStore- Parameters:
parameters- A map of parameters or null
-
setCachedProducer
public void setCachedProducer(MessageProducer cachedProducer)
-
setProducer
public void setProducer(MessageProducer producer)
-
-