|
WebLogic Server 6.0 Code Examples, BEA Systems, Inc. | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.jms.topic.TopicSend
This examples shows how to establish a connection and send messages to the JMS topic. The classes in this package operate on the same topic. Run the classes together to observe message being sent and received. This class is used to send messages to the topic.
Field Summary | |
static java.lang.String |
JMS_FACTORY
Defines the JMS connection factory. |
static java.lang.String |
JNDI_FACTORY
Defines the JNDI context factory. |
protected javax.jms.TextMessage |
msg
|
protected javax.jms.TopicConnection |
tcon
|
protected javax.jms.TopicConnectionFactory |
tconFactory
|
protected javax.jms.Topic |
topic
|
static java.lang.String |
TOPIC
Defines the topic. |
protected javax.jms.TopicPublisher |
tpublisher
|
protected javax.jms.TopicSession |
tsession
|
Constructor Summary | |
TopicSend()
|
Method Summary | |
void |
close()
Closes JMS objects. |
protected static javax.naming.InitialContext |
getInitialContext(java.lang.String url)
Get initial JNDI context. |
void |
init(javax.naming.Context ctx,
java.lang.String topicName)
Creates all the necessary objects for sending messages to a JMS Topic. |
static void |
main(java.lang.String[] args)
main() method. |
protected static void |
readAndSend(TopicSend ts)
Prompts, reads, and sends a message. |
void |
send(java.lang.String message)
Sends a message to a JMS topic. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final java.lang.String JMS_FACTORY
public static final java.lang.String JNDI_FACTORY
protected javax.jms.TextMessage msg
protected javax.jms.TopicConnection tcon
protected javax.jms.TopicConnectionFactory tconFactory
protected javax.jms.Topic topic
public static final java.lang.String TOPIC
protected javax.jms.TopicPublisher tpublisher
protected javax.jms.TopicSession tsession
Constructor Detail |
public TopicSend()
Method Detail |
public void close() throws javax.jms.JMSException
javax.jms.JMSException
- if JMS fails to close objects due to internal errorprotected static javax.naming.InitialContext getInitialContext(java.lang.String url) throws javax.naming.NamingException
javax.naming.NamingException
- if problem occurs with JNDI context interfacepublic void init(javax.naming.Context ctx, java.lang.String topicName) throws javax.naming.NamingException, javax.jms.JMSException
ctx
- JNDI initial contexttopicName
- name of topicNamingExcpetion
- if problem occurred with the JNDI context interfacejavax.jms.JMSException
- if JMS fails to initialize due to internal errorpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- WebLogic Server URLjava.lang.Exception
- if operation failsprotected static void readAndSend(TopicSend ts) throws java.io.IOException, javax.jms.JMSException
ts
- TopicSendjava.io.IOException
- if problem occurs during read/write operationjavax.jms.JMSException
- if JMS fails due to internal errorpublic void send(java.lang.String message) throws javax.jms.JMSException
javax.jms.JMSException
- if JMS fails to send message due to internal error
|
Documentation is available at http://e-docs.bea.com/wls/docs60 |
|||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |