Search in sources :

Example 1 with MQRuntimeException

use of com.sun.messaging.jms.MQRuntimeException 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 MQRuntimeException

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

the class JMSContextImpl method createObjectMessage.

@Override
public ObjectMessage createObjectMessage() {
    checkNotClosed();
    disallowSetClientID();
    try {
        return session.createObjectMessage();
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 3 with MQRuntimeException

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

the class JMSContextImpl method createTemporaryQueue.

@Override
public TemporaryQueue createTemporaryQueue() {
    checkNotClosed();
    disallowSetClientID();
    try {
        return session.createTemporaryQueue();
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 4 with MQRuntimeException

use of com.sun.messaging.jms.MQRuntimeException 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 5 with MQRuntimeException

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

the class JMSContextImpl method createMapMessage.

@Override
public MapMessage createMapMessage() {
    checkNotClosed();
    disallowSetClientID();
    try {
        return session.createMapMessage();
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Aggregations

MQRuntimeException (com.sun.messaging.jms.MQRuntimeException)29 JMSException (jakarta.jms.JMSException)29 MQInvalidDestinationRuntimeException (com.sun.messaging.jms.MQInvalidDestinationRuntimeException)8 InvalidDestinationException (jakarta.jms.InvalidDestinationException)7 MQMessageFormatRuntimeException (com.sun.messaging.jms.MQMessageFormatRuntimeException)6 MessageFormatException (jakarta.jms.MessageFormatException)6 MQIllegalStateRuntimeException (com.sun.messaging.jms.MQIllegalStateRuntimeException)5 IllegalStateException (jakarta.jms.IllegalStateException)5 MQInvalidSelectorRuntimeException (com.sun.messaging.jms.MQInvalidSelectorRuntimeException)2 MQMessageNotWriteableRuntimeException (com.sun.messaging.jms.MQMessageNotWriteableRuntimeException)2 MQTransactionInProgressRuntimeException (com.sun.messaging.jms.MQTransactionInProgressRuntimeException)2 MQTransactionRolledBackRuntimeException (com.sun.messaging.jms.MQTransactionRolledBackRuntimeException)2 MessageNotWriteableException (jakarta.jms.MessageNotWriteableException)2 AdministeredObject (com.sun.messaging.AdministeredObject)1 MQInvalidClientIDRuntimeException (com.sun.messaging.jms.MQInvalidClientIDRuntimeException)1 MQSecurityRuntimeException (com.sun.messaging.jms.MQSecurityRuntimeException)1 BytesMessage (jakarta.jms.BytesMessage)1 IllegalStateRuntimeException (jakarta.jms.IllegalStateRuntimeException)1 InvalidClientIDException (jakarta.jms.InvalidClientIDException)1 InvalidClientIDRuntimeException (jakarta.jms.InvalidClientIDRuntimeException)1