public class EchoRequesterNode extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private javax.jms.Connection |
connection |
private javax.jms.MessageConsumer |
consumer |
private javax.jms.MessageProducer |
producer |
private javax.jms.Queue |
replyQueue |
private javax.jms.Session |
session |
Constructor and Description |
---|
EchoRequesterNode()
constructor, establishes and starts connection to JMS provider specified in
JNDI (via jndi.properties), afterwards producer and consumer are ready
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
main routine and starting point of program
|
void |
receiveAndPrintMessages()
synchronously receives the TextMessages in an infinite loop and prints
payload text to StdOut
|
void |
sendMessage(java.lang.String text)
creates TextMessage for JMS provider with temporary reply queue set and sends
it to Destination of producer, which is configured in Conf.QUEUE
|
private javax.jms.Connection connection
private javax.jms.Session session
private javax.jms.MessageProducer producer
private javax.jms.MessageConsumer consumer
private javax.jms.Queue replyQueue
public EchoRequesterNode() throws javax.naming.NamingException, javax.jms.JMSException
javax.naming.NamingException
- JNDI exceptionsjavax.jms.JMSException
- JMS exceptionspublic void receiveAndPrintMessages() throws javax.jms.JMSException
javax.jms.JMSException
- JMS exceptionsTextMessage
public void sendMessage(java.lang.String text) throws javax.jms.JMSException
text
- text to be sendjavax.jms.JMSException
- JMS exceptionspublic static void main(java.lang.String[] args)
args[0]
- text to be send to echo service replier