Exception Handling

October 13th, 2006 Admin Posted in Java Message Service(JMS) No Comments »

The root class for exceptions thrown by JMS API methods is JMSException. Catching JMSException provides a generic way of handling all exceptions related to the JMS API. The JMSException class includes the following subclasses, which are described in the API documentation:

•    IllegalStateException

•    InvalidClientIDException

•    InvalidDestinationException

•    InvalidSelectorException

•    JMSSecurityException

•    MessageEOFException

•    MessageFormatException

•    MessageNotReadableException

•    MessageNotWriteableException

•    ResourceAllocationException

•    TransactionInProgressException

•    TransactionRolledBackException

AddThis Social Bookmark Button

Writing the PUB/SUB TopicSubscriber Programs

October 13th, 2006 Admin Posted in Java Message Service(JMS) No Comments »

1)Performs a JNDI lookup of the TopicConnectionFactory and Topic

2)Creates a connection and session

3)Creates a TopicSubscriber

4)Creates an instance of the TextListener class and registers it as the message listener for the TopicSubscriber

5)Starts the connection, causing message delivery to begin

6)Listens for the messages published to the topic

7)Closes the connection, which automatically closes the session and TopicSubscriber

AddThis Social Bookmark Button

Writing the PUB/SUB TopicPublisher Programs

October 13th, 2006 Admin Posted in Java Message Service(JMS) No Comments »

1)Performs a JNDI lookup of the TopicConnectionFactory and Topic

2)Creates a connection and session

3)Creates a TopicPublisher

4)Creates a TextMessage

5)Publishes one or more messages to the topic

6)Closes the connection, which automatically closes the session and TopicPublisher

AddThis Social Bookmark Button