Search in sources :

Example 1 with MQInvalidDestinationRuntimeException

use of com.sun.messaging.jms.MQInvalidDestinationRuntimeException in project openmq by eclipse-ee4j.

the class JMSProducerImpl method send.

@Override
public JMSProducer send(Destination destination, Map<String, Object> payload) {
    contextImpl.checkNotClosed();
    configureMessageProducer();
    MapMessage mapMessage = contextImpl.createMapMessage();
    configureMessage(mapMessage);
    if (payload != null) {
        try {
            for (Iterator<Entry<String, Object>> entryIter = payload.entrySet().iterator(); entryIter.hasNext(); ) {
                Entry<String, Object> thisEntry = entryIter.next();
                mapMessage.setObject(thisEntry.getKey(), thisEntry.getValue());
            }
        } catch (MessageNotWriteableException e) {
            throw new MQMessageNotWriteableRuntimeException(e);
        } catch (MessageFormatException e) {
            throw new MQMessageFormatRuntimeException(e);
        } catch (JMSException e) {
            throw new MQRuntimeException(e);
        }
    }
    try {
        if (completionListener == null) {
            contextImpl.getMessageProducer().send(destination, mapMessage);
        } else {
            contextImpl.getMessageProducer().send(destination, mapMessage, completionListener);
        }
    } catch (InvalidDestinationException e) {
        throw new MQInvalidDestinationRuntimeException(e);
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
    return this;
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException) MapMessage(jakarta.jms.MapMessage) MQInvalidDestinationRuntimeException(com.sun.messaging.jms.MQInvalidDestinationRuntimeException) InvalidDestinationException(jakarta.jms.InvalidDestinationException) JMSException(jakarta.jms.JMSException) MessageNotWriteableException(jakarta.jms.MessageNotWriteableException) Entry(java.util.Map.Entry) MQMessageNotWriteableRuntimeException(com.sun.messaging.jms.MQMessageNotWriteableRuntimeException) AdministeredObject(com.sun.messaging.AdministeredObject) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 2 with MQInvalidDestinationRuntimeException

use of com.sun.messaging.jms.MQInvalidDestinationRuntimeException in project openmq by eclipse-ee4j.

the class JMSContextImpl method createBrowser.

@Override
public QueueBrowser createBrowser(Queue queue) {
    checkNotClosed();
    disallowSetClientID();
    try {
        return session.createBrowser(queue);
    } catch (InvalidDestinationException e) {
        throw new MQInvalidDestinationRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : MQInvalidDestinationRuntimeException(com.sun.messaging.jms.MQInvalidDestinationRuntimeException) InvalidDestinationException(jakarta.jms.InvalidDestinationException) JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 3 with MQInvalidDestinationRuntimeException

use of com.sun.messaging.jms.MQInvalidDestinationRuntimeException in project openmq by eclipse-ee4j.

the class JMSContextImpl method createBrowser.

@Override
public QueueBrowser createBrowser(Queue queue, String messageSelector) {
    checkNotClosed();
    disallowSetClientID();
    try {
        return session.createBrowser(queue, messageSelector);
    } catch (InvalidDestinationException e) {
        throw new MQInvalidDestinationRuntimeException(e);
    } catch (InvalidSelectorException e) {
        throw new MQInvalidSelectorRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : InvalidSelectorException(jakarta.jms.InvalidSelectorException) MQInvalidDestinationRuntimeException(com.sun.messaging.jms.MQInvalidDestinationRuntimeException) MQInvalidSelectorRuntimeException(com.sun.messaging.jms.MQInvalidSelectorRuntimeException) InvalidDestinationException(jakarta.jms.InvalidDestinationException) JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 4 with MQInvalidDestinationRuntimeException

use of com.sun.messaging.jms.MQInvalidDestinationRuntimeException in project openmq by eclipse-ee4j.

the class JMSProducerImpl method send.

@Override
public JMSProducer send(Destination destination, Message message) {
    contextImpl.checkNotClosed();
    checkMessage(message);
    configureMessageProducer();
    configureMessage(message);
    try {
        if (completionListener == null) {
            contextImpl.getMessageProducer().send(destination, message);
        } else {
            contextImpl.getMessageProducer().send(destination, message, completionListener);
        }
    } catch (InvalidDestinationException e) {
        throw new MQInvalidDestinationRuntimeException(e);
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
    return this;
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException) MQInvalidDestinationRuntimeException(com.sun.messaging.jms.MQInvalidDestinationRuntimeException) InvalidDestinationException(jakarta.jms.InvalidDestinationException) JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 5 with MQInvalidDestinationRuntimeException

use of com.sun.messaging.jms.MQInvalidDestinationRuntimeException in project openmq by eclipse-ee4j.

the class JMSProducerImpl method send.

@Override
public JMSProducer send(Destination destination, Serializable payload) {
    contextImpl.checkNotClosed();
    configureMessageProducer();
    ObjectMessage objectMessage = contextImpl.createObjectMessage(payload);
    configureMessage(objectMessage);
    try {
        if (completionListener == null) {
            contextImpl.getMessageProducer().send(destination, objectMessage);
        } else {
            contextImpl.getMessageProducer().send(destination, objectMessage, completionListener);
        }
    } catch (InvalidDestinationException e) {
        throw new MQInvalidDestinationRuntimeException(e);
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
    return this;
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException) ObjectMessage(jakarta.jms.ObjectMessage) MQInvalidDestinationRuntimeException(com.sun.messaging.jms.MQInvalidDestinationRuntimeException) InvalidDestinationException(jakarta.jms.InvalidDestinationException) JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Aggregations

MQInvalidDestinationRuntimeException (com.sun.messaging.jms.MQInvalidDestinationRuntimeException)7 MQRuntimeException (com.sun.messaging.jms.MQRuntimeException)7 InvalidDestinationException (jakarta.jms.InvalidDestinationException)7 JMSException (jakarta.jms.JMSException)7 MQMessageFormatRuntimeException (com.sun.messaging.jms.MQMessageFormatRuntimeException)5 MessageFormatException (jakarta.jms.MessageFormatException)5 MQMessageNotWriteableRuntimeException (com.sun.messaging.jms.MQMessageNotWriteableRuntimeException)2 MessageNotWriteableException (jakarta.jms.MessageNotWriteableException)2 AdministeredObject (com.sun.messaging.AdministeredObject)1 MQInvalidSelectorRuntimeException (com.sun.messaging.jms.MQInvalidSelectorRuntimeException)1 BytesMessage (jakarta.jms.BytesMessage)1 InvalidSelectorException (jakarta.jms.InvalidSelectorException)1 MapMessage (jakarta.jms.MapMessage)1 ObjectMessage (jakarta.jms.ObjectMessage)1 TextMessage (jakarta.jms.TextMessage)1 Entry (java.util.Map.Entry)1