public class ConsumerPullNode extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private javax.jms.Connection |
connection |
private javax.jms.MessageConsumer |
consumer |
private javax.jms.Session |
session |
Constructor and Description |
---|
ConsumerPullNode()
constructor, establishes and starts connection to JMS provider specified in
JNDI (via jndi.properties), afterwards consumer is ready
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
main routine and starting point of program
|
void |
receiveAndPrintMessages(long timeout)
synchronously receives the TextMessages in an infinite loop and prints
payload text to StdOut
|
private javax.jms.Connection connection
private javax.jms.Session session
private javax.jms.MessageConsumer consumer
public ConsumerPullNode() throws javax.naming.NamingException, javax.jms.JMSException
javax.naming.NamingException
- JNDI exceptionsjavax.jms.JMSException
- JMS exceptionspublic void receiveAndPrintMessages(long timeout) throws javax.jms.JMSException
timeout
- timeout in msjavax.jms.JMSException
- JMS exceptionsTextMessage
public static void main(java.lang.String[] args)
args[0]
- time to wait in ms