examples.jms.queue
Class QueueSend
java.lang.Object
|
+--examples.jms.queue.QueueSend
- public class QueueSend
- extends java.lang.Object
This example shows how to establish a connection
and send messages to the JMS queue. The classes in this
package operate on the same JMS queue. Run the classes together to
witness messages being sent and received, and to browse the queue
for messages. The class is used to send messages to the queue.
- Author:
- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
Field Summary |
static java.lang.String |
JMS_FACTORY
Defines the JMS context factory. |
static java.lang.String |
JNDI_FACTORY
Defines the JNDI context factory. |
static java.lang.String |
QUEUE
Defines the queue. |
Method Summary |
void |
close()
Closes JMS objects. |
void |
init(javax.naming.Context ctx,
java.lang.String queueName)
Creates all the necessary objects for sending
messages to a JMS queue. |
static void |
main(java.lang.String[] args)
main() method. |
void |
send(java.lang.String message)
Sends a message to a JMS queue. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JMS_FACTORY
public static final java.lang.String JMS_FACTORY
- Defines the JMS context factory.
JNDI_FACTORY
public static final java.lang.String JNDI_FACTORY
- Defines the JNDI context factory.
QUEUE
public static final java.lang.String QUEUE
- Defines the queue.
QueueSend
public QueueSend()
close
public void close()
throws javax.jms.JMSException
- Closes JMS objects.
- Throws:
javax.jms.JMSException
- if JMS fails to close objects due to internal error
init
public void init(javax.naming.Context ctx,
java.lang.String queueName)
throws javax.naming.NamingException,
javax.jms.JMSException
- Creates all the necessary objects for sending
messages to a JMS queue.
- Parameters:
ctx
- JNDI initial contextqueueName
- name of queue- Throws:
javax.naming.NamingException
- if operation cannot be performedjavax.jms.JMSException
- if JMS fails to initialize due to internal error
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- main() method.
- Parameters:
args
- WebLogic Server URL- Throws:
java.lang.Exception
- if operation fails
send
public void send(java.lang.String message)
throws javax.jms.JMSException
- Sends a message to a JMS queue.
- Throws:
javax.jms.JMSException
- if JMS fails to send message due to internal error
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.