private Destination getReplyDestination ( Session session , Message message ) throws JMSException { if ( message . getHeader ( org . springframework . messaging . MessageHeaders . REPLY_CHANNEL ) != null ) { if ( message . getHeader ( org . springframework . messaging . MessageHeaders . REPLY_CHANNEL ) instanceof Destination ) { return ( Destination ) message . getHeader ( org . springframework . messaging . MessageHeaders . REPLY_CHANNEL ) ; } else { return resolveDestinationName ( message . getHeader ( org . springframework . messaging . MessageHeaders . REPLY_CHANNEL ) . toString ( ) , session ) ; } } else if ( endpointConfiguration . getReplyDestination ( ) != null ) { return endpointConfiguration . getReplyDestination ( ) ; } else if ( StringUtils . hasText ( endpointConfiguration . getReplyDestinationName ( ) ) ) { return resolveDestinationName ( endpointConfiguration . getReplyDestinationName ( ) , session ) ; } if ( endpointConfiguration . isPubSubDomain ( ) && session instanceof TopicSession ) { return session . createTemporaryTopic ( ) ; } else { return session . createTemporaryQueue ( ) ; } }
Retrieve the reply destination either by injected instance destination name or by creating a new temporary destination .