use of eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method receiveInvalidSalesMessage.
@Override
public void receiveInvalidSalesMessage(@Observes @ReceiveInvalidSalesMessageEvent ExchangeMessageEvent event) {
try {
ReceiveInvalidSalesMessage request = JAXBMarshaller.unmarshallTextMessage(event.getJmsMessage(), ReceiveInvalidSalesMessage.class);
exchangeLog.log(request, LogType.RECEIVE_SALES_REPORT, ExchangeLogStatusTypeType.FAILED, TypeRefType.SALES_REPORT, request.getRespondToInvalidMessageRequest(), true);
producer.sendMessageOnQueue(request.getRespondToInvalidMessageRequest(), MessageQueue.SALES);
} catch (ExchangeLogException e) {
firePluginFault(event, "Could not log the incoming invalid sales message", e);
} catch (ExchangeMessageException | ExchangeModelMarshallException e) {
firePluginFault(event, "Error when receiving an invalid sales message from FLUX", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method sendSalesResponse.
@Override
public void sendSalesResponse(@Observes @SendSalesResponseEvent ExchangeMessageEvent message) {
try {
SendSalesResponseRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SendSalesResponseRequest.class);
ExchangeLogStatusTypeType validationStatus = request.getValidationStatus();
exchangeLog.log(request, LogType.SEND_SALES_RESPONSE, validationStatus, TypeRefType.SALES_RESPONSE, request.getResponse(), false);
if (validationStatus == ExchangeLogStatusTypeType.SUCCESSFUL || validationStatus == ExchangeLogStatusTypeType.SUCCESSFUL_WITH_WARNINGS) {
eu.europa.ec.fisheries.schema.exchange.plugin.v1.SendSalesResponseRequest pluginRequest = new eu.europa.ec.fisheries.schema.exchange.plugin.v1.SendSalesResponseRequest();
pluginRequest.setRecipient(request.getSenderOrReceiver());
pluginRequest.setResponse(request.getResponse());
pluginRequest.setMethod(ExchangePluginMethod.SEND_SALES_RESPONSE);
exchangeEventOutgoingService.sendSalesResponseToPlugin(pluginRequest, request.getPluginType());
} else {
log.error("Received invalid response from the Sales module: " + request.getResponse());
}
} catch (ExchangeModelMarshallException | ExchangeMessageException e) {
fireExchangeFault(message, "Error when sending a Sales response to FLUX", e);
} catch (ExchangeLogException e) {
fireExchangeFault(message, "Could not log the outgoing sales response.", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventOutgoingServiceBean method sendFLUXFAQueryToPlugin.
@Override
public void sendFLUXFAQueryToPlugin(@Observes @SendFaQueryToPluginEvent ExchangeMessageEvent message) {
try {
SetFAQueryMessageRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SetFAQueryMessageRequest.class);
LOG.debug("Got SetFAQueryMessageRequest in exchange : " + request.getRequest());
String text = ExchangePluginRequestMapper.createSendFLUXFAQueryRequest(request.getRequest(), request.getDestination(), request.getFluxDataFlow(), request.getSenderOrReceiver());
LOG.debug("Message to plugin {}", text);
String pluginMessageId = producer.sendEventBusMessage(text, ((request.getPluginType() == BELGIAN_ACTIVITY) ? ExchangeServiceConstants.BELGIAN_ACTIVITY_PLUGIN_SERVICE_NAME : ExchangeServiceConstants.FLUX_ACTIVITY_PLUGIN_SERVICE_NAME));
LOG.info("Message sent to Flux ERS Plugin :" + pluginMessageId);
exchangeLog.log(request, LogType.SEND_FA_QUERY_MSG, ExchangeLogStatusTypeType.SENT, TypeRefType.FA_QUERY, request.getRequest(), false);
} catch (ExchangeModelMarshallException | ExchangeMessageException | ExchangeLogException e) {
LOG.error("Unable to send FLUX FA Report to plugin.", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventOutgoingServiceBean method sendFLUXFAReportToPlugin.
@Override
public void sendFLUXFAReportToPlugin(@Observes @SendFaReportToPluginEvent ExchangeMessageEvent message) {
try {
SetFLUXFAReportMessageRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SetFLUXFAReportMessageRequest.class);
LOG.debug("Got SetFAQueryMessageRequest in exchange : " + request.getRequest());
String text = ExchangePluginRequestMapper.createSendFLUXFAReportRequest(request.getRequest(), request.getDestination(), request.getFluxDataFlow(), request.getSenderOrReceiver());
LOG.debug("Message to plugin {}", text);
String pluginMessageId = producer.sendEventBusMessage(text, ((request.getPluginType() == BELGIAN_ACTIVITY) ? ExchangeServiceConstants.BELGIAN_ACTIVITY_PLUGIN_SERVICE_NAME : ExchangeServiceConstants.FLUX_ACTIVITY_PLUGIN_SERVICE_NAME));
LOG.info("Message sent to Flux ERS Plugin :" + pluginMessageId);
exchangeLog.log(request, LogType.SEND_FLUX_FA_REPORT_MSG, ExchangeLogStatusTypeType.SENT, TypeRefType.FA_REPORT, request.getRequest(), false);
} catch (ExchangeModelMarshallException | ExchangeMessageException | ExchangeLogException e) {
LOG.error("Unable to send FLUX FA Report to plugin.", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventOutgoingServiceBean method sendFLUXFAResponseToPlugin.
@Override
public void sendFLUXFAResponseToPlugin(@Observes @SendFLUXFAResponseToPluginEvent ExchangeMessageEvent message) {
try {
SetFLUXFAResponseMessageRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SetFLUXFAResponseMessageRequest.class);
LOG.debug("[INFO] Got FLUXFAResponse in exchange :" + request.getRequest());
String text = ExchangePluginRequestMapper.createSetFLUXFAResponseRequestWithOn(request.getRequest(), request.getDestination(), request.getFluxDataFlow(), request.getSenderOrReceiver(), request.getOnValue());
final ExchangeLogType log = exchangeLog.log(request, LogType.SEND_FLUX_RESPONSE_MSG, request.getStatus(), TypeRefType.FA_RESPONSE, request.getRequest(), false);
if (!log.getStatus().equals(ExchangeLogStatusTypeType.FAILED)) {
// Send response only if it is NOT FAILED
LOG.debug("[INFO] Sending FLUXFAResponse to Flux Activity Plugin {}", text);
String pluginMessageId = producer.sendEventBusMessage(text, ((request.getPluginType() == BELGIAN_ACTIVITY) ? ExchangeServiceConstants.BELGIAN_ACTIVITY_PLUGIN_SERVICE_NAME : ExchangeServiceConstants.FLUX_ACTIVITY_PLUGIN_SERVICE_NAME));
LOG.debug("[INFO] FLUXFAResponse sent to Flux Activity Plugin {}" + pluginMessageId);
} else {
LOG.info("[WARN] FLUXFAResponse is FAILED so won't be sent to Flux Activity Plugin {}", text);
}
} catch (ExchangeModelMarshallException | ExchangeMessageException | ExchangeLogException e) {
LOG.error("Unable to send FLUX FA Report to plugin.", e);
}
}
Aggregations