Search in sources :

Example 11 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 12 with MQRuntimeException

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

the class DirectConnection method _setClientIDForContext.

/**
 * Set clientID to the specified value, bypassing any checks as to whether calling setClientID is allowed at this time.
 */
@Override
public void _setClientIDForContext(String clientID) {
    String methodName = "_setClientIDForContext()";
    _loggerJC.fine(_lgrMID_INF + "connectionId=" + connectionId + ":" + methodName);
    try {
        if (!this.inACC) {
            _unsupported(methodName);
        }
        this._checkIfClosed(methodName);
        this._setClientID(clientID);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 13 with MQRuntimeException

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

the class JMSContextImpl method commit.

@Override
public void commit() {
    checkNotClosed();
    disallowSetClientID();
    try {
        session.commit();
    } catch (TransactionRolledBackException e) {
        throw new MQTransactionRolledBackRuntimeException(e);
    } catch (TransactionInProgressException e) {
        throw new MQTransactionInProgressRuntimeException(e);
    } catch (IllegalStateException e) {
        throw new MQIllegalStateRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : IllegalStateException(jakarta.jms.IllegalStateException) MQTransactionInProgressRuntimeException(com.sun.messaging.jms.MQTransactionInProgressRuntimeException) TransactionRolledBackException(jakarta.jms.TransactionRolledBackException) TransactionInProgressException(jakarta.jms.TransactionInProgressException) JMSException(jakarta.jms.JMSException) MQIllegalStateRuntimeException(com.sun.messaging.jms.MQIllegalStateRuntimeException) MQTransactionRolledBackRuntimeException(com.sun.messaging.jms.MQTransactionRolledBackRuntimeException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 14 with MQRuntimeException

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

the class JMSContextImpl method createBytesMessage.

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

Example 15 with MQRuntimeException

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

the class JMSContextImpl method createTopic.

@Override
public Topic createTopic(String topicName) {
    checkNotClosed();
    disallowSetClientID();
    try {
        return session.createTopic(topicName);
    } 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