use of com.sun.messaging.jms.MQRuntimeException in project openmq by eclipse-ee4j.
the class JMSContextImpl method rollback.
@Override
public void rollback() {
checkNotClosed();
disallowSetClientID();
try {
session.rollback();
} catch (IllegalStateException e) {
throw new MQIllegalStateRuntimeException(e);
} catch (JMSException e) {
throw new MQRuntimeException(e);
}
}
use of com.sun.messaging.jms.MQRuntimeException in project openmq by eclipse-ee4j.
the class JMSContextImpl method createMessage.
@Override
public Message createMessage() {
checkNotClosed();
disallowSetClientID();
try {
return session.createMessage();
} catch (JMSException e) {
throw new MQRuntimeException(e);
}
}
use of com.sun.messaging.jms.MQRuntimeException 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;
}
use of com.sun.messaging.jms.MQRuntimeException 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;
}
use of com.sun.messaging.jms.MQRuntimeException 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;
}
Aggregations