Search in sources :

Example 1 with MQMessageFormatRuntimeException

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

the class JMSProducerImpl method getShortProperty.

@Override
public short getShortProperty(String name) {
    contextImpl.checkNotClosed();
    MessageImpl.checkPropertyNameSet(name);
    Object obj = properties.get(name);
    try {
        return ValueConvert.toShort(obj);
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    }
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException) AdministeredObject(com.sun.messaging.AdministeredObject)

Example 2 with MQMessageFormatRuntimeException

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

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

the class JMSProducerImpl method getIntProperty.

@Override
public int getIntProperty(String name) {
    contextImpl.checkNotClosed();
    MessageImpl.checkPropertyNameSet(name);
    Object obj = properties.get(name);
    try {
        return ValueConvert.toInt(obj);
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    }
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException) AdministeredObject(com.sun.messaging.AdministeredObject)

Example 4 with MQMessageFormatRuntimeException

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

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

the class JMSProducerImpl method getBooleanProperty.

@Override
public boolean getBooleanProperty(String name) {
    contextImpl.checkNotClosed();
    MessageImpl.checkPropertyNameSet(name);
    try {
        return ValueConvert.toBoolean(properties.get(name));
    } catch (MessageFormatException e) {
        throw new MQMessageFormatRuntimeException(e);
    }
}
Also used : MessageFormatException(jakarta.jms.MessageFormatException) MQMessageFormatRuntimeException(com.sun.messaging.jms.MQMessageFormatRuntimeException)

Aggregations

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