Search in sources :

Example 1 with SetFLUXFAReportMessageRequest

use of eu.europa.ec.fisheries.schema.exchange.module.v1.SetFLUXFAReportMessageRequest in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeEventIncomingServiceBean method processFLUXFAReportMessage.

@Override
public void processFLUXFAReportMessage(@Observes @SetFluxFAReportMessageEvent ExchangeMessageEvent message) {
    try {
        SetFLUXFAReportMessageRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SetFLUXFAReportMessageRequest.class);
        log.debug("Got FLUXFAReportMessage in exchange :" + request.getRequest());
        ExchangeLogType exchangeLogType = exchangeLog.log(request, LogType.RCV_FLUX_FA_REPORT_MSG, ExchangeLogStatusTypeType.ISSUED, TypeRefType.FA_REPORT, request.getRequest(), true);
        String msg = RulesModuleRequestMapper.createSetFLUXFAReportMessageRequest(extractPluginType(request), request.getRequest(), request.getUsername(), extractLogId(message, exchangeLogType), request.getFluxDataFlow(), request.getSenderOrReceiver(), request.getOnValue());
        forwardToRules(msg, message, null);
    } catch (RulesModelMapperException | ExchangeModelMarshallException e) {
        log.error("Couldn't map to SetFLUXFAReportMessageRequest when processing FLUXFAReportMessage coming from fa-plugin!", e);
    } catch (ExchangeLogException e) {
        log.error("Couldn't log FAReportMessage received from plugin into database", e);
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) RulesModelMapperException(eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMapperException) SetFLUXFAReportMessageRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.SetFLUXFAReportMessageRequest)

Example 2 with SetFLUXFAReportMessageRequest

use of eu.europa.ec.fisheries.schema.exchange.module.v1.SetFLUXFAReportMessageRequest 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);
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeMessageException(eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException) SetFLUXFAReportMessageRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.SetFLUXFAReportMessageRequest)

Aggregations

SetFLUXFAReportMessageRequest (eu.europa.ec.fisheries.schema.exchange.module.v1.SetFLUXFAReportMessageRequest)2 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)2 ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)2 ExchangeLogType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType)1 ExchangeMessageException (eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException)1 RulesModelMapperException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMapperException)1