use of com.sun.messaging.jms.MQMessageFormatRuntimeException 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.MQMessageFormatRuntimeException 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.MQMessageFormatRuntimeException in project openmq by eclipse-ee4j.
the class JMSProducerImpl method getByteProperty.
@Override
public byte getByteProperty(String name) {
contextImpl.checkNotClosed();
MessageImpl.checkPropertyNameSet(name);
try {
return ValueConvert.toByte(properties.get(name));
} catch (MessageFormatException e) {
throw new MQMessageFormatRuntimeException(e);
}
}
use of com.sun.messaging.jms.MQMessageFormatRuntimeException in project openmq by eclipse-ee4j.
the class JMSProducerImpl method send.
@Override
public JMSProducer send(Destination destination, String payload) {
contextImpl.checkNotClosed();
configureMessageProducer();
TextMessage textMessage;
if (payload == null) {
textMessage = contextImpl.createTextMessage();
} else {
textMessage = contextImpl.createTextMessage(payload);
}
configureMessage(textMessage);
try {
if (completionListener == null) {
contextImpl.getMessageProducer().send(destination, textMessage);
} else {
contextImpl.getMessageProducer().send(destination, textMessage, 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.MQMessageFormatRuntimeException in project openmq by eclipse-ee4j.
the class JMSProducerImpl method send.
@Override
public JMSProducer send(Destination destination, byte[] payload) {
contextImpl.checkNotClosed();
configureMessageProducer();
BytesMessage bytesMessage = contextImpl.createBytesMessage();
configureMessage(bytesMessage);
if (payload != null) {
try {
bytesMessage.writeBytes(payload);
} catch (MessageNotWriteableException e) {
throw new MQMessageNotWriteableRuntimeException(e);
} catch (JMSException e) {
throw new MQRuntimeException(e);
}
}
try {
if (completionListener == null) {
contextImpl.getMessageProducer().send(destination, bytesMessage);
} else {
contextImpl.getMessageProducer().send(destination, bytesMessage, completionListener);
}
} catch (InvalidDestinationException e) {
throw new MQInvalidDestinationRuntimeException(e);
} catch (MessageFormatException e) {
throw new MQMessageFormatRuntimeException(e);
} catch (JMSException e) {
throw new MQRuntimeException(e);
}
return this;
}
Aggregations