Example usage for javax.jms JMSException JMSException

List of usage examples for javax.jms JMSException JMSException

Introduction

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

Prototype

public JMSException(String reason) 

Source Link

Document

Constructs a JMSException with the specified reason and with the error code defaulting to null.

Usage

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/**
 *
 * Creates a <code>MessageConsumer</code> for the specified destination.
 * Only queue destinations are supported at this time.
 * It will ignore any argument in messageSelector.
 * //from  w ww.  j ava  2s .  c o  m
 * @param destination
 *            a queue destination
 * @param messageSelector           
 * @return new message consumer
 * @throws JMSException
 *             If session is closed or queue destination is not used
 */

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
    if (messageSelector != null) {
        throw new JMSException("SQSSession does not support MessageSelector. This should be null.");
    }
    return createConsumer(destination);
}

From source file:org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.java

protected void onMessage(Message jmsMessage, Session session) throws JMSException {
    if (logger.isTraceEnabled()) {
        logger.trace("Received: " + jmsMessage);
    }/*  ww w.  ja v a 2s . c  o  m*/

    JmsContext context = null;
    MessageExchange exchange = null;

    try {
        context = marshaler.createContext(jmsMessage);
        exchange = marshaler.createExchange(context, getContext());
        configureExchangeTarget(exchange);
        if (synchronous) {
            try {
                sendSync(exchange);
            } catch (Exception e) {
                handleException(exchange, e, session, context);
            }
            if (exchange.getStatus() != ExchangeStatus.DONE) {
                processExchange(exchange, session, context);
            }
        } else {
            if (stateless) {
                exchange.setProperty(PROP_JMS_CONTEXT, context);
            } else {
                store.store(exchange.getExchangeId(), context);
            }
            boolean success = false;
            try {
                send(exchange);
                success = true;
            } catch (Exception e) {
                handleException(exchange, e, session, context);
            } finally {
                if (!success && !stateless) {
                    store.load(exchange.getExchangeId());
                }
            }
        }
    } catch (Exception e) {
        try {
            handleException(exchange, e, session, context);
        } catch (Exception e1) {
            throw (JMSException) new JMSException("Error sending JBI exchange").initCause(e);
        }
    }
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/**
 * Creates a <code>MessageConsumer</code> for the specified destination.
 * Only queue destinations are supported at this time. It will ignore any
 * argument in messageSelector and NoLocal.
 * //from w w  w .  j ava  2 s  .  c  om
 * @param destination
 *            a queue destination
 * @param messageSelector
 * @param NoLocal
 * @return new message consumer
 * @throws JMSException
 *             If session is closed or queue destination is not used
 */
@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal)
        throws JMSException {
    if (messageSelector != null) {
        throw new JMSException("SQSSession does not support MessageSelector. This should be null.");
    }
    return createConsumer(destination);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. This method is related to transaction which SQS doesn't support */
@Override/*from w w  w  .  ja v  a 2  s . c o  m*/
public void commit() throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. This method is related to transaction which SQS doesn't support */
@Override/*from   w w  w . j  a  va 2s  .  c om*/
public void rollback() throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. This method is related to Topic which SQS doesn't support */
@Override//from ww w .  ja va  2s  . c  o  m
public void unsubscribe(String name) throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. */
@Override// ww  w. j a  v  a 2 s  .c  om
public Topic createTopic(String topicName) throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. */
@Override//from ww w.  j  a  v  a2s.c  o  m
public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. */
@Override//  www .  j a v  a  2s .  c  om
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector,
        boolean noLocal) throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}

From source file:com.amazon.sqs.javamessaging.SQSSession.java

/** This method is not supported. */
@Override/* w w  w  . ja va 2  s.c o  m*/
public QueueBrowser createBrowser(Queue queue) throws JMSException {
    throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
}