Example usage for javax.jms QueueReceiver getQueue

List of usage examples for javax.jms QueueReceiver getQueue

Introduction

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

Prototype


Queue getQueue() throws JMSException;

Source Link

Document

Gets the Queue associated with this queue receiver.

Usage

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

/**
 * Gets the queueReceiver, by utilizing the <code>getInputQueue()</code> method.<br/>
 * For serverside getQueueReceiver() the creating of the QueueReceiver is done
 * without the <code>selector</code> information, as this is not allowed
 * by IFSA.<br/>/* w  ww  .ja  v a  2 s .co  m*/
 * For a clientconnection, the receiver is done with the <code>getClientReplyQueue</code>
 * @see javax.jms.QueueReceiver
 */
protected QueueReceiver getServiceReceiver(QueueSession session) throws IfsaException {

    try {
        QueueReceiver queueReceiver;

        if (isProvider()) {
            String selector = getProviderSelector();
            if (StringUtils.isEmpty(selector)) {
                queueReceiver = session.createReceiver(getServiceQueue());
            } else {
                //log.debug(getLogPrefix()+"using selector ["+selector+"]");
                try {
                    queueReceiver = session.createReceiver(getServiceQueue(), selector);
                } catch (JMSException e) {
                    log.warn("caught exception, probably due to use of selector [" + selector
                            + "], falling back to non-selected mode", e);
                    queueReceiver = session.createReceiver(getServiceQueue());
                }
            }
        } else {
            throw new IfsaException("cannot obtain ServiceReceiver: Requestor cannot act as Provider");
        }
        if (log.isDebugEnabled() && !isSessionsArePooled()) {
            log.debug(getLogPrefix() + "got receiver for queue [" + queueReceiver.getQueue().getQueueName()
                    + "] " + ToStringBuilder.reflectionToString(queueReceiver));
        }
        return queueReceiver;
    } catch (JMSException e) {
        throw new IfsaException(e);
    }
}

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

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

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

private static Destination getDestination(MessageConsumer messageConsumer) throws JMSException {
    if (messageConsumer instanceof QueueReceiver) {
        QueueReceiver queueReceiver = (QueueReceiver) messageConsumer;
        return queueReceiver.getQueue();
    }/*from ww  w .  ja  v a  2  s  . com*/
    if (messageConsumer instanceof TopicSubscriber) {
        TopicSubscriber topicSubscriber = (TopicSubscriber) messageConsumer;
        return topicSubscriber.getTopic();
    }
    throw new JMSException("unknown message consumer type: " + messageConsumer.getClass());
}

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

public String toString() {
    ToStringBuilder builder = new ToStringBuilder(this);
    try {//  w  w  w  .j ava2 s  . c om
        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();
}