Вопрос

Anyone can explain the real purpose of JMSTemplate.execute method. It can accept a session callback. The Spring document does not say any details about it.

Это было полезно?

Решение

The Spring documentation is pretty specific about its JMS capabilities, and it ends with a brief description of JmsTemplate.execute(). That coupled with the javadoc for JmsTemplate.execute() and the SessionCallback should give you a pretty clear idea of what it does.

Другие советы

You can use it to get hold of a raw JMS Session and do something with this session object. For eg, you can use it to get a QueueBrowser to peek at the contents of the queue without actually consuming the messages.

execute(new SessionCallback<QueueBrowser>() {
        public QueueBrowser doInJms(Session session) throws JMSException {
            return session.createBrowser(queue);
        }
    }, true);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top