use of eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityMessageServiceBean method sendModuleErrorResponseMessage.
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void sendModuleErrorResponseMessage(@Observes @ActivityMessageErrorEvent EventMessage message) {
Connection connection = null;
try {
connection = getConnectionFactory().createConnection();
final Session session = JMSUtils.connectToQueue(connection);
log.info("Sending message back to recipient from Activity Module with correlationId {} on queue: {}", message.getJmsMessage().getJMSMessageID());
String data = JAXBMarshaller.marshallJaxBObjectToString(message.getFault());
TextMessage response = session.createTextMessage(data);
response.setJMSCorrelationID(message.getJmsMessage().getJMSMessageID());
session.createProducer(message.getJmsMessage().getJMSReplyTo()).send(response);
} catch (ActivityModelMarshallException | JMSException e) {
log.error("Error when returning module activity request", e);
log.error("[ Error when returning module activity request. ] {} {}", e.getMessage(), e.getStackTrace());
} finally {
JMSUtils.disconnectQueue(connection);
}
}
Aggregations