public void sendTextMessageWithDestination ( final String destinationName , final String messageContent ) { if ( ! this . isConnected ( ) ) { throw new JmsNotConnectedException ( "JMS connection is down " + destinationName ) ; } final Session session = getSession ( ) ; final MessageProducer producer = getProducer ( destinationName ) ; try { TextMessage message = session . createTextMessage ( messageContent ) ; producer . send ( message ) ; } catch ( JMSException e ) { throw new JmsException ( "Unable to send message to " + destinationName , e ) ; } }
Send a text message given a queue or topic name and a text message .