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);
}
}
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);
}
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;
}
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);
}
}
Aggregations