|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.messenger.MessengerSupport
public abstract class MessengerSupport
MessengerSupport
is an abstract base class which implements
most of the functionality of Messenger. Derivations need to specify the
connection and session creation and the pooling strategy.
Constructor Summary | |
---|---|
MessengerSupport()
|
Method Summary | |
---|---|
void |
addListener(javax.jms.Destination destination,
javax.jms.MessageListener listener)
Adds a message listener on the given destination |
void |
addListener(javax.jms.Destination destination,
String selector,
javax.jms.MessageListener listener)
|
protected javax.jms.MessageConsumer |
borrowMessageConsumer(MessengerSession messengerSession,
javax.jms.Session session,
javax.jms.Destination destination)
|
protected javax.jms.MessageConsumer |
borrowMessageConsumer(MessengerSession messengerSession,
javax.jms.Session session,
javax.jms.Destination destination,
String selector)
|
protected abstract MessengerSession |
borrowMessengerSession()
|
void |
close()
Closes the underlying JMS connection |
void |
commit()
Commits all messages done in this thread and releases any locks |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Destination destination)
Creates a browser on the given Queue |
protected javax.jms.QueueBrowser |
createBrowser(MessengerSession session,
javax.jms.Destination destination)
|
javax.jms.BytesMessage |
createBytesMessage()
|
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Destination destination,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
Creates a ConnectionConsumer which is useful if used inside an application server to associate multiple threads with consuming from a JMS destination |
javax.jms.ConnectionConsumer |
createConnectionConsumer(javax.jms.Destination destination,
String selector,
javax.jms.ServerSessionPool sessionPool,
int maxMessages)
Creates a ConnectionConsumer which is useful if used inside an application server to associate multiple threads with consuming from a JMS destination |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination)
Creates a MessageConsumer for the given JMS Desintation |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination destination,
String selector)
Creates a MessageConsumer for the given JMS Desintation and JMS selector |
javax.jms.MapMessage |
createMapMessage()
|
javax.jms.Message |
createMessage()
|
protected javax.jms.MessageConsumer |
createMessageConsumer(MessengerSession messengerSession,
javax.jms.Session session,
javax.jms.Destination destination)
|
protected javax.jms.MessageConsumer |
createMessageConsumer(MessengerSession messengerSession,
javax.jms.Session session,
javax.jms.Destination destination,
String selector)
|
protected javax.jms.MessageProducer |
createMessageProducer(MessengerSession messengerSession,
javax.jms.Destination destination)
|
javax.jms.ObjectMessage |
createObjectMessage()
|
javax.jms.ObjectMessage |
createObjectMessage(Serializable object)
|
javax.jms.StreamMessage |
createStreamMessage()
|
javax.jms.Destination |
createTemporaryDestination()
Returns a new temporary destination |
javax.jms.TextMessage |
createTextMessage()
|
javax.jms.TextMessage |
createTextMessage(String text)
|
abstract javax.jms.Connection |
getConnection()
Returns the underlying JMS connection that this Messenger is using |
int |
getDeliveryMode()
Returns the delivery mode used on messages sent via this Messenger |
int |
getDeliveryMode(javax.jms.Destination destination)
Get the producer's default delivery mode. |
javax.jms.Destination |
getDestination(String subject)
Returns the destination for the given subject name |
boolean |
getDisableMessageID(javax.jms.Destination destination)
Get an indication of whether message IDs are disabled. |
boolean |
getDisableMessageTimestamp(javax.jms.Destination destination)
Get an indication of whether message timestamps are disabled. |
String |
getDurableName()
|
String |
getName()
Gets the name that this Messenger is called in a MessengerManager |
int |
getPriority(javax.jms.Destination destination)
Get the producer's default priority. |
protected javax.jms.Queue |
getQueue(javax.jms.QueueSession session,
String subject)
|
long |
getTimeToLive(javax.jms.Destination destination)
Get the producer's default delivery mode. |
protected javax.jms.Topic |
getTopic(javax.jms.TopicSession session,
String subject)
|
boolean |
isCacheProducers()
Gets whether MessageProducer instances should be cached or not, which defaults to true |
boolean |
isCacheRequestors()
Gets whether we should cache the requestor object per thread? |
boolean |
isDurable()
Gets whether topic subscribers are durable or not |
boolean |
isJndiDestinations()
Getter for jndiDestinations |
boolean |
isNoLocal()
Gets whether local messages are ignored when topic based subscription is used with a message selector |
protected abstract boolean |
isTopic(javax.jms.Connection connection)
|
protected abstract boolean |
isTopic(javax.jms.ConnectionFactory factory)
|
javax.jms.Message |
receive(javax.jms.Destination destination)
Receives a message on the given destination, blocking until one is returned |
javax.jms.Message |
receive(javax.jms.Destination destination,
long timeoutMillis)
Receives a message on the given destination, blocking for the specified timeout |
javax.jms.Message |
receive(javax.jms.Destination destination,
String selector)
Receives a message on the given destination and message selector, blocking until one is returned |
javax.jms.Message |
receive(javax.jms.Destination destination,
String selector,
long timeoutMillis)
Receives a message on the given destination and selector, blocking for the specified timeout |
javax.jms.Message |
receiveNoWait(javax.jms.Destination destination)
Receives a message on the given destination without blocking or returns null |
javax.jms.Message |
receiveNoWait(javax.jms.Destination destination,
String selector)
Receives a message on the given destination and selector without blocking or returns null |
void |
removeListener(javax.jms.Destination destination,
javax.jms.MessageListener listener)
|
void |
removeListener(javax.jms.Destination destination,
String selector,
javax.jms.MessageListener listener)
|
protected void |
returnMessageConsumer(javax.jms.MessageConsumer messageConsumer)
Returns a message consumer back to the pool. |
protected abstract void |
returnMessengerSession(MessengerSession session)
|
void |
rollback()
Rolls back any messages done in this thread and releases any locks |
void |
run()
Allows this current thread to be given to the JMS connection to process messages. |
void |
send(javax.jms.Destination destination,
javax.jms.Message message)
Sends a message on the given destination |
void |
send(javax.jms.Destination destination,
javax.jms.Message message,
int deliveryMode,
int priority,
long timeToLive)
Extends the send capability to send by specifying additional options. |
void |
setCacheProducers(boolean cacheProducers)
Sets whether MessageProducer instances should be cached or not, which defaults to true |
void |
setCacheRequestors(boolean cacheRequestors)
Sets whether we should cache the requestor object per thread? |
void |
setDeliveryMode(javax.jms.Destination destination,
int deliveryMode)
Set the producer's default delivery mode. |
void |
setDeliveryMode(int deliveryMode)
Sets the delivery mode used on messages sent via this Messenger |
void |
setDisableMessageID(javax.jms.Destination destination,
boolean value)
Set whether message IDs are disabled. |
void |
setDisableMessageTimestamp(javax.jms.Destination destination,
boolean value)
Set whether message timestamps are disabled. |
void |
setDurable(boolean durable)
Sets whether topic subscribers are durable or not |
void |
setDurableName(String durableName)
Sets the durable name used for durable topic based subscriptions |
void |
setJndiDestinations(boolean jndiDestinations)
Setter for jndiDestinations |
void |
setName(String name)
Sets the name that this Messenger is called in a MessengerManager |
void |
setNoLocal(boolean noLocal)
Sets whether local messages are ignored when topic based subscription is used with a message selector |
void |
setPersistentDelivery(boolean persistentDelivery)
Sets whether message delivery should be persistent or not |
void |
setPriority(javax.jms.Destination destination,
int priority)
Set the producer's default priority. |
void |
setTimeToLive(javax.jms.Destination destination,
long timeToLive)
Set the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.messenger.Messenger |
---|
call, call, createServerSessionPool, getAsyncSession, getSession, getSessionFactory |
Constructor Detail |
---|
public MessengerSupport()
Method Detail |
---|
public String toString()
toString
in class Object
public javax.jms.Destination getDestination(String subject) throws javax.jms.JMSException
Messenger
getDestination
in interface Messenger
javax.jms.JMSException
public javax.jms.Destination createTemporaryDestination() throws javax.jms.JMSException
Messenger
createTemporaryDestination
in interface Messenger
javax.jms.JMSException
public void send(javax.jms.Destination destination, javax.jms.Message message) throws javax.jms.JMSException
Messenger
send
in interface Messenger
javax.jms.JMSException
public javax.jms.Message receive(javax.jms.Destination destination) throws javax.jms.JMSException
Messenger
receive
in interface Messenger
javax.jms.JMSException
public javax.jms.Message receive(javax.jms.Destination destination, String selector) throws javax.jms.JMSException
Messenger
receive
in interface Messenger
javax.jms.JMSException
public javax.jms.Message receive(javax.jms.Destination destination, long timeoutMillis) throws javax.jms.JMSException
Messenger
receive
in interface Messenger
javax.jms.JMSException
public javax.jms.Message receive(javax.jms.Destination destination, String selector, long timeoutMillis) throws javax.jms.JMSException
Messenger
receive
in interface Messenger
javax.jms.JMSException
public javax.jms.Message receiveNoWait(javax.jms.Destination destination) throws javax.jms.JMSException
Messenger
receiveNoWait
in interface Messenger
javax.jms.JMSException
public javax.jms.Message receiveNoWait(javax.jms.Destination destination, String selector) throws javax.jms.JMSException
Messenger
receiveNoWait
in interface Messenger
javax.jms.JMSException
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination) throws javax.jms.JMSException
Messenger
createConsumer
in interface Messenger
javax.jms.JMSException
public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination, String selector) throws javax.jms.JMSException
Messenger
createConsumer
in interface Messenger
javax.jms.JMSException
public void run()
Messenger
run
in interface Messenger
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSException
Messenger
createConnectionConsumer
in interface Messenger
javax.jms.JMSException
public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination destination, String selector, javax.jms.ServerSessionPool sessionPool, int maxMessages) throws javax.jms.JMSException
Messenger
createConnectionConsumer
in interface Messenger
javax.jms.JMSException
public abstract javax.jms.Connection getConnection() throws javax.jms.JMSException
Messenger
getConnection
in interface Messenger
javax.jms.JMSException
public void addListener(javax.jms.Destination destination, javax.jms.MessageListener listener) throws javax.jms.JMSException
Messenger
addListener
in interface Messenger
javax.jms.JMSException
public void addListener(javax.jms.Destination destination, String selector, javax.jms.MessageListener listener) throws javax.jms.JMSException
addListener
in interface Messenger
javax.jms.JMSException
public void removeListener(javax.jms.Destination destination, javax.jms.MessageListener listener) throws javax.jms.JMSException
removeListener
in interface Messenger
javax.jms.JMSException
public void removeListener(javax.jms.Destination destination, String selector, javax.jms.MessageListener listener) throws javax.jms.JMSException
removeListener
in interface Messenger
javax.jms.JMSException
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException
createBytesMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException
createMapMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.Message createMessage() throws javax.jms.JMSException
createMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException
createObjectMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage(Serializable object) throws javax.jms.JMSException
createObjectMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException
createStreamMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException
createTextMessage
in interface Messenger
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage(String text) throws javax.jms.JMSException
createTextMessage
in interface Messenger
javax.jms.JMSException
public void commit() throws javax.jms.JMSException
Messenger
commit
in interface Messenger
javax.jms.JMSException
public void rollback() throws javax.jms.JMSException
Messenger
rollback
in interface Messenger
javax.jms.JMSException
public void close() throws javax.jms.JMSException
Messenger
close
in interface Messenger
javax.jms.JMSException
public javax.jms.QueueBrowser createBrowser(javax.jms.Destination destination) throws javax.jms.JMSException
createBrowser
in interface Messenger
javax.jms.JMSException
public int getDeliveryMode(javax.jms.Destination destination) throws javax.jms.JMSException
getDeliveryMode
in interface Messenger
javax.jms.JMSException
public void setDeliveryMode(javax.jms.Destination destination, int deliveryMode) throws javax.jms.JMSException
setDeliveryMode
in interface Messenger
javax.jms.JMSException
public int getPriority(javax.jms.Destination destination) throws javax.jms.JMSException
getPriority
in interface Messenger
javax.jms.JMSException
public void setPriority(javax.jms.Destination destination, int priority) throws javax.jms.JMSException
setPriority
in interface Messenger
javax.jms.JMSException
public long getTimeToLive(javax.jms.Destination destination) throws javax.jms.JMSException
getTimeToLive
in interface Messenger
javax.jms.JMSException
public void setTimeToLive(javax.jms.Destination destination, long timeToLive) throws javax.jms.JMSException
Set the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
setTimeToLive
in interface Messenger
javax.jms.JMSException
public boolean getDisableMessageTimestamp(javax.jms.Destination destination) throws javax.jms.JMSException
getDisableMessageTimestamp
in interface Messenger
javax.jms.JMSException
public void setDisableMessageTimestamp(javax.jms.Destination destination, boolean value) throws javax.jms.JMSException
setDisableMessageTimestamp
in interface Messenger
javax.jms.JMSException
public void send(javax.jms.Destination destination, javax.jms.Message message, int deliveryMode, int priority, long timeToLive) throws javax.jms.JMSException
javax.jms.JMSException
public boolean getDisableMessageID(javax.jms.Destination destination) throws javax.jms.JMSException
getDisableMessageID
in interface Messenger
javax.jms.JMSException
public void setDisableMessageID(javax.jms.Destination destination, boolean value) throws javax.jms.JMSException
setDisableMessageID
in interface Messenger
javax.jms.JMSException
public String getName()
getName
in interface Messenger
public void setName(String name)
public void setJndiDestinations(boolean jndiDestinations)
public boolean isJndiDestinations()
public boolean isDurable()
public void setDurable(boolean durable)
public boolean isCacheRequestors()
public void setCacheRequestors(boolean cacheRequestors)
public String getDurableName()
public void setDurableName(String durableName)
public boolean isNoLocal()
public void setNoLocal(boolean noLocal)
public boolean isCacheProducers()
public void setCacheProducers(boolean cacheProducers)
public int getDeliveryMode()
public void setDeliveryMode(int deliveryMode)
deliveryMode
- The deliveryMode to setpublic void setPersistentDelivery(boolean persistentDelivery)
persistentDelivery
- protected abstract MessengerSession borrowMessengerSession() throws javax.jms.JMSException
javax.jms.JMSException
protected abstract void returnMessengerSession(MessengerSession session)
protected abstract boolean isTopic(javax.jms.Connection connection) throws javax.jms.JMSException
javax.jms.JMSException
protected abstract boolean isTopic(javax.jms.ConnectionFactory factory) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.MessageProducer createMessageProducer(MessengerSession messengerSession, javax.jms.Destination destination) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.MessageConsumer borrowMessageConsumer(MessengerSession messengerSession, javax.jms.Session session, javax.jms.Destination destination) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.MessageConsumer borrowMessageConsumer(MessengerSession messengerSession, javax.jms.Session session, javax.jms.Destination destination, String selector) throws javax.jms.JMSException
javax.jms.JMSException
protected void returnMessageConsumer(javax.jms.MessageConsumer messageConsumer) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.MessageConsumer createMessageConsumer(MessengerSession messengerSession, javax.jms.Session session, javax.jms.Destination destination) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.MessageConsumer createMessageConsumer(MessengerSession messengerSession, javax.jms.Session session, javax.jms.Destination destination, String selector) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.QueueBrowser createBrowser(MessengerSession session, javax.jms.Destination destination) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.Queue getQueue(javax.jms.QueueSession session, String subject) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.Topic getTopic(javax.jms.TopicSession session, String subject) throws javax.jms.JMSException
javax.jms.JMSException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |