private MessageProducer getProducer ( final String destinationName ) { if ( ! producers . containsKey ( destinationName ) ) { Session session = getSession ( ) ; Destination destination = getDestination ( destinationName ) ; MessageProducer producer ; try { producer = session . createProducer ( destination ) ; } catch ( JMSException e ) { throw new JmsException ( "Unable to create producer for destination " + destinationName , e ) ; } producers . put ( destinationName , producer ) ; } return producers . get ( destinationName ) ; }
Get the MessageProducer or create one from the JMS session .