Search in sources :

Example 1 with QueueBrowser

use of jakarta.jms.QueueBrowser in project spring-framework by spring-projects.

the class JmsTemplate method browseSelected.

@Override
@Nullable
public <T> T browseSelected(final String queueName, @Nullable final String messageSelector, final BrowserCallback<T> action) throws JmsException {
    Assert.notNull(action, "Callback object must not be null");
    return execute(session -> {
        Queue queue = (Queue) getDestinationResolver().resolveDestinationName(session, queueName, false);
        QueueBrowser browser = createBrowser(session, queue, messageSelector);
        try {
            return action.doInJms(session, browser);
        } finally {
            JmsUtils.closeQueueBrowser(browser);
        }
    }, true);
}
Also used : TemporaryQueue(jakarta.jms.TemporaryQueue) Queue(jakarta.jms.Queue) QueueBrowser(jakarta.jms.QueueBrowser) Nullable(org.springframework.lang.Nullable)

Aggregations

Queue (jakarta.jms.Queue)1 QueueBrowser (jakarta.jms.QueueBrowser)1 TemporaryQueue (jakarta.jms.TemporaryQueue)1 Nullable (org.springframework.lang.Nullable)1