Example usage for javax.jms QueueReceiver getMessageSelector

List of usage examples for javax.jms QueueReceiver getMessageSelector

Introduction

In this page you can find the example usage for javax.jms QueueReceiver getMessageSelector.

Prototype


String getMessageSelector() throws JMSException;

Source Link

Document

Gets this message consumer's message selector expression.

Usage

From source file:nl.nn.adapterframework.extensions.ifsa.jms.IfsaRequesterSender.java

/**
 * Retrieves a message with the specified correlationId from queue or other channel, but does no processing on it.
 *///from w w w  . j  a  v  a2 s.com
private Message getRawReplyMessage(QueueSession session, IFSAQueue queue, TextMessage sentMessage)
        throws SenderException, TimeOutException {

    String selector = null;
    Message msg = null;
    QueueReceiver replyReceiver = null;
    try {
        replyReceiver = getReplyReceiver(session, sentMessage);
        selector = replyReceiver.getMessageSelector();

        long timeout = getExpiry(queue);
        log.debug(getLogPrefix() + "start waiting at most [" + timeout
                + "] ms for reply on message using selector [" + selector + "]");
        msg = replyReceiver.receive(timeout);
        if (msg == null) {
            log.info(getLogPrefix() + "received null reply");
        } else {
            log.info(getLogPrefix() + "received reply");
        }

    } catch (Exception e) {
        throw new SenderException(getLogPrefix() + "got exception retrieving reply", e);
    } finally {
        try {
            closeReplyReceiver(replyReceiver);
        } catch (IfsaException e) {
            log.error(getLogPrefix() + "error closing replyreceiver", e);
        }
    }
    if (msg == null) {
        throw new TimeOutException(
                getLogPrefix() + " timed out waiting for reply using selector [" + selector + "]");
    }
    if (msg instanceof IFSATimeOutMessage) {
        throw new TimeOutException(getLogPrefix()
                + "received IFSATimeOutMessage waiting for reply using selector [" + selector + "]");
    }
    return msg;
    //      try {
    //         TextMessage result = (TextMessage)msg;
    //         return result;
    //      } catch (Exception e) {
    //         throw new SenderException(getLogPrefix()+"reply received for message using selector ["+selector+"] cannot be cast to TextMessage ["+msg.getClass().getName()+"]",e);
    //      }
}

From source file:org.jbpm.bpel.integration.jms.StartListener.java

public String toString() {
    ToStringBuilder builder = new ToStringBuilder(this);
    try {//from   w ww. j a  v  a2s .c o m
        QueueReceiver queueReceiver = (QueueReceiver) messageConsumer;
        builder.append("queue", queueReceiver.getQueue()).append("selector",
                queueReceiver.getMessageSelector());
    } catch (JMSException e) {
        log.debug("could not fill request listener fields", e);
    }
    return builder.toString();
}