Example usage for org.springframework.jms.core JmsTemplate execute

List of usage examples for org.springframework.jms.core JmsTemplate execute

Introduction

In this page you can find the example usage for org.springframework.jms.core JmsTemplate execute.

Prototype

@Override
    @Nullable
    public <T> T execute(ProducerCallback<T> action) throws JmsException 

Source Link

Usage

From source file:net.lr.jmsbridge.ConnectionPool.java

public Destination getReplyDestination(ConnectionFactory connectionFactory, UserNameAndPassword auth) {
    Destination replyDest = replyDestMap.get(auth);
    if (replyDest != null) {
        return replyDest;
    }/*from  ww w. j a  v a 2  s  .  c om*/

    JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setConnectionFactory(connectionFactory);
    replyDest = (Destination) jmsTemplate.execute(new SessionCallback() {

        @Override
        public Object doInJms(Session session) throws JMSException {
            return session.createTemporaryQueue();
        }

    });
    replyDestMap.put(auth, replyDest);
    return replyDest;
}