|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.connectors.jms.JMSConsumerBase
org.osesb.connectors.jms.JMSQueueReceiver
public class JMSQueueReceiver
This descendant of JMSConsumerBase is a blocking, Queue receiver.
An instance of a JMSQueueReceiver is associated with a particular JMS Destination. The JMS Session object is cached (but can be reset) and JMSQueueReceiver(s) can be pooled. See the org.osesb.objectpools package for JMS producer and consumer pools. Instances of JMSQueueReceiver are constructed with a org.osesb.configuration.JMSClientConfiguration, which contains properties for creating a JMS connection. JMSQueueReceiver implements startJMS(), close(), and receiveJMSMessage() methods that are Queue-specific.
| Field Summary | |
|---|---|
protected javax.jms.Queue |
queue
The Queue for this JMS client. |
protected javax.jms.QueueConnection |
queueConnection
The QueueConnection for this JMS client. |
protected javax.jms.QueueSession |
queueSession
The QueueSession for this JMS client. |
| Fields inherited from class org.osesb.connectors.jms.JMSConsumerBase |
|---|
connectionStarted, dateTimeOfLastMessage, dateTimeServiceStarted, heartbeatInterval, jmsClientConfiguration, jmsMessage, log, messageID, messageText, MIN_HEARTBEAT_INTERVAL, numberOfMessagesReceived, session, thisClassName |
| Constructor Summary | |
|---|---|
JMSQueueReceiver(JMSClientConfiguration jmsClientConfiguration)
Creates a new instance of JMSQueueReceiver and starts JMS. |
|
JMSQueueReceiver(JMSClientConfiguration jmsClientConfiguration,
javax.jms.Queue queue)
Creates a new instance of JMSQueueReceiver and starts JMS using the specified Queue. |
|
| Method Summary | |
|---|---|
protected void |
checkSession()
Checks the QueueSession and restarts JMS connection, if required. |
void |
close()
Release JMS resources. |
javax.jms.Connection |
getConnection()
Returns the JMS Connection for this JMS client. |
javax.jms.Destination |
getDestination()
Returns the JMS Destination for this JMS client. |
java.lang.String |
getDestinationName()
Returns the name of the JMS Destination for this JMS client. |
protected void |
logConsumerStartupMessage()
Logs a JMS startup message for JMS consumers. |
protected void |
logMessage(java.lang.String logMessage)
Log the message. |
static void |
main(java.lang.String[] args)
main() - for testing. |
javax.jms.Message |
receiveJMSMessage()
Receive a JMS Message using the configured Queue; waits for a message indefinitely. |
javax.jms.Message |
receiveJMSMessage(long receiveTimeoutMilliseconds,
java.lang.String messageSelector)
Receive a JMS Message using the configured Queue. |
protected javax.jms.Message |
retryReceiveJMSMessage(long receiveTimeoutMilliseconds,
java.lang.String messageSelector)
Retry receiving a message using the configured Queue. |
void |
startJMS()
Initialize JMS objects according to JMSClientConfiguration and start the connection. |
| Methods inherited from class org.osesb.connectors.jms.JMSConsumerBase |
|---|
checkJMSConnection, consumerStartupMessage, finalize, getDateTimeOfLastMessage, getDateTimeServiceStarted, getHeartbeatInterval, getJMSClientConfiguration, getNumberOfMessagesReceived, getSession, isConnectionStarted, onException, onMessage, run, setNumberOfMessagesReceived, setSession |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.jms.QueueConnection queueConnection
protected javax.jms.QueueSession queueSession
protected javax.jms.Queue queue
| Constructor Detail |
|---|
public JMSQueueReceiver(JMSClientConfiguration jmsClientConfiguration)
throws java.lang.Exception
jmsClientConfiguration - The JMSClientConfiguration object to use for this JMS client.
java.lang.Exception - if constructed with a null JMSClientConfiguration.
public JMSQueueReceiver(JMSClientConfiguration jmsClientConfiguration,
javax.jms.Queue queue)
throws java.lang.Exception
jmsClientConfiguration - The JMSClientConfiguration object to use for this client.queue - The Queue to start the JMS connection for.
java.lang.Exception - if constructed with a null JMSClientConfiguration.| Method Detail |
|---|
public javax.jms.Message receiveJMSMessage()
throws java.lang.Exception
receiveJMSMessage in class JMSConsumerBasejava.lang.Exception - if a general is error encountered.
public javax.jms.Message receiveJMSMessage(long receiveTimeoutMilliseconds,
java.lang.String messageSelector)
throws java.lang.Exception
receiveJMSMessage in class JMSConsumerBasereceiveTimeoutMilliseconds - receive timeout in milliseconds.
If receiveTimeout > 0, then the receiver waits for a message for
the specified number of milliseconds, otherwise, the receiver
waits for a message indefinitely.messageSelector - The JMS messageSelector.
java.lang.Exception - if a general is error encountered.
protected javax.jms.Message retryReceiveJMSMessage(long receiveTimeoutMilliseconds,
java.lang.String messageSelector)
throws java.lang.Exception
receiveTimeoutMilliseconds - receive timeout in milliseconds.
If receiveTimeout > 0, then the receiver waits for a message for
the specified number of milliseconds, otherwise, the receiver
waits for a message indefinitely.messageSelector - The JMS messageSelector.
java.lang.Exception - if a general is error encountered.public java.lang.String getDestinationName()
getDestinationName in class JMSConsumerBasepublic javax.jms.Connection getConnection()
getConnection in class JMSConsumerBasepublic javax.jms.Destination getDestination()
getDestination in class JMSConsumerBaseprotected void logMessage(java.lang.String logMessage)
logMessage in class JMSConsumerBaselogMessage - The message to log.public void startJMS()
startJMS in class JMSConsumerBaseprotected void logConsumerStartupMessage()
protected void checkSession()
throws java.lang.Exception
checkSession in class JMSConsumerBasejava.lang.Exception - if there was a problem getting a QueueSession.public void close()
close in class JMSConsumerBasepublic static void main(java.lang.String[] args)
args - commandline arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||