|
JMS Conector demo (OC4J 10g R3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectMyChannel
Example of using JMS 1.1 unified operations.
| Field Summary | |
private Connection |
connection
|
private MessageConsumer |
consumer
|
private MessageProducer |
producer
|
private Session |
session
|
| Constructor Summary | |
MyChannel(java.lang.String connectionFactoryName,
java.lang.String destinationName)
MyChannel constructor. |
|
| Method Summary | |
void |
close()
Close channel. |
java.io.Serializable |
receive()
Receive message (wait forever). |
java.io.Serializable |
receive(long timeout)
Receive message (wait a while). |
void |
send(java.io.Serializable obj)
Send message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Connection connection
private Session session
private MessageProducer producer
private MessageConsumer consumer
| Constructor Detail |
public MyChannel(java.lang.String connectionFactoryName,
java.lang.String destinationName)
throws java.lang.Exception
The constructor uses the named connection factory to open a "channel" attached to the named destination. Note that JMS 1.1 features mean that this class will work correctly even if a TopicConnectionFactory is used with a Queue destination (or a QueueConnectionFactory is used with a Topic destination). And, of course, a generic ConnectionFactory will also work with both queues and topics.
connectionFactoryName - the logical name (<res-ref-name>) or JNDI location of a JMS connection factory.destinationName - the logical name (<message-destination-ref-name>) or JNDI location of a JMS destination
JMSSecurityException - if client authentication fails due to an invalid user name or password
NamingException - if there is a problem looking up the connection factory or destination
InvalidDestinationException - if the object at destinationName is not a valid destination
JMSException - if non-transacted auto-acknowledge sessions are not supported, or on a JMS internal error
java.lang.Exception| Method Detail |
public void send(java.io.Serializable obj)
throws JMSException
prerequisite: channel is open
obj - object to be sent
JMSException
public java.io.Serializable receive()
throws JMSException
prerequisite: channel is open
null if no message was received
JMSException
public java.io.Serializable receive(long timeout)
throws JMSException
prerequisite: channel is open
timeout - maximum time (in milliseconds) to wait for a message to arrive
null if no message was received
JMSException
public void close()
throws JMSException
prerequisite: channel is open
Once a MyChannel object is closed, it may no longer be used to send or receive messages.
JMSException
|
JMS Conector demo (OC4J 10g R3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||