Search in sources :

Example 26 with MQRuntimeException

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

the class JMSProducerImpl method configureMessageProducer.

/**
 * Configure the MessageProducer prior to sending a message
 *
 * Note that although the MessageProducer is associated with the JMSContext and so may be used by other JMSConsumer
 * objects for that JMSContext only one thread is allowed to send a message at a time so this code does not need to be
 * threadsafe.
 */
private void configureMessageProducer() {
    MessageProducer messageProducer = contextImpl.getMessageProducer();
    try {
        messageProducer.setPriority(priority);
        messageProducer.setDeliveryDelay(deliveryDelay);
        messageProducer.setDeliveryMode(deliveryMode);
        messageProducer.setTimeToLive(timeToLive);
        messageProducer.setDisableMessageID(disableMessageID);
        messageProducer.setDisableMessageTimestamp(disableMessageTimestamp);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : JMSException(jakarta.jms.JMSException) MessageProducer(jakarta.jms.MessageProducer) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 27 with MQRuntimeException

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

the class JMSProducerImpl method checkAndSetProperty.

private void checkAndSetProperty(String name, Object value) {
    // Verify that the specified property name is not null and is not empty
    MessageImpl.checkPropertyNameSet(name);
    // Verify that the specified value is a valid message property value
    try {
        MessageImpl.checkValidPropertyValue(name, value);
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
    // Verify that the specified property name is allowed
    try {
        MessageImpl.checkValidPropertyName(name);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
    // all OK, now set the property
    properties.put(name, value);
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException) JMSException(jakarta.jms.JMSException) MQRuntimeException(com.sun.messaging.jms.MQRuntimeException)

Example 28 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, 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)

Example 29 with MQRuntimeException

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

the class ConnectionAdapter 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) {
    _loggerJC.entering(_className, "_setClientIDForContext()", clientID);
    checkClosed2();
    try {
        xac._setClientID(clientID);
    } catch (InvalidClientIDException ice) {
        throw new MQInvalidClientIDRuntimeException(ice);
    } catch (JMSException e) {
        throw new MQRuntimeException(e);
    }
}
Also used : InvalidClientIDException(jakarta.jms.InvalidClientIDException) MQInvalidClientIDRuntimeException(com.sun.messaging.jms.MQInvalidClientIDRuntimeException) 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