Use the JNDI to get a ConnectionFactory and Destination Object (either Queue or Topic).Create a Connection object. Create a Session object. Create MessageProducer object (either QueueSender or TopicPublisher). Start the Connection. Send/Publish the Message to its Destination. Close the session and Connection.