Search in sources :

Example 11 with ActivityModelMarshallException

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);
    }
}
Also used : ActivityModelMarshallException(eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException) Connection(javax.jms.Connection) JMSException(javax.jms.JMSException) TextMessage(javax.jms.TextMessage) Session(javax.jms.Session) TransactionAttribute(javax.ejb.TransactionAttribute)

Aggregations

ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)11 JMSException (javax.jms.JMSException)6 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)5 TextMessage (javax.jms.TextMessage)4 MessageException (eu.europa.ec.fisheries.uvms.commons.message.api.MessageException)3 ActivityModuleException (eu.europa.ec.fisheries.ers.service.exception.ActivityModuleException)2 GetNonUniqueIdsRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest)2 GetNonUniqueIdsResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse)2 RulesModelMapperException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMapperException)2 SubscriptionParameter (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionParameter)2 SubscriptionPermissionResponse (eu.europa.ec.fisheries.wsdl.subscription.module.SubscriptionPermissionResponse)2 TransactionAttribute (javax.ejb.TransactionAttribute)2 FLUXFAQueryMessage (un.unece.uncefact.data.standard.fluxfaquerymessage._3.FLUXFAQueryMessage)2 EventMessage (eu.europa.ec.fisheries.uvms.activity.message.event.carrier.EventMessage)1 ActivityModuleMethod (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityModuleMethod)1 ActivityModuleRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityModuleRequest)1 ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)1 FACatchSummaryReportRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportRequest)1 FACatchSummaryReportResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse)1 FishingTripRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripRequest)1