public class ProducerNode extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private javax.jms.Connection |
connection |
private javax.jms.MessageProducer |
producer |
private javax.jms.Session |
session |
Constructor and Description |
---|
ProducerNode()
constructor, establishes and starts connection to JMS provider specified in
JNDI (via jndi.properties), afterwards producer is ready
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
main routine and starting point of program
|
void |
sendMessage(java.lang.String text,
java.lang.String priority)
creates TextMessage for JMS provider sets String property "Priority" to value
of parameter priority and sends message 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
public ProducerNode() throws javax.naming.NamingException, javax.jms.JMSException
javax.naming.NamingException
- JNDI exceptionsjavax.jms.JMSException
- JMS exceptionspublic void sendMessage(java.lang.String text, java.lang.String priority) throws javax.jms.JMSException
text
- payload of messagepriority
- value of String property "Priority"javax.jms.JMSException
- JMS exceptionspublic static void main(java.lang.String[] args)
args[0]
- time to wait in msargs[1]
- of message ("high" or anything else)