Search in sources :

Example 1 with SetFAQueryMessageRequest

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

the class ExchangeEventIncomingServiceBean method processFAQueryMessage.

@Override
public void processFAQueryMessage(@Observes @SetFaQueryMessageEvent ExchangeMessageEvent message) {
    try {
        SetFAQueryMessageRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SetFAQueryMessageRequest.class);
        log.debug("Got FAQueryMessage in exchange :" + request.getRequest());
        ExchangeLogType exchangeLogType = exchangeLog.log(request, LogType.RECEIVE_FA_QUERY_MSG, ExchangeLogStatusTypeType.ISSUED, TypeRefType.FA_QUERY, request.getRequest(), true);
        String msg = RulesModuleRequestMapper.createSetFaQueryMessageRequest(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 SetFAQueryMessageRequest when processing FAQueryMessage coming from fa-plugin!", e);
    } catch (ExchangeLogException e) {
        log.error("Couldn't log FAQueryMessage received from plugin into database", e);
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) SetFAQueryMessageRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.SetFAQueryMessageRequest) 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)

Example 2 with SetFAQueryMessageRequest

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

Example 3 with SetFAQueryMessageRequest

use of eu.europa.ec.fisheries.schema.exchange.module.v1.SetFAQueryMessageRequest 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)

Example 4 with SetFAQueryMessageRequest

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

the class ExchangeEventIncomingServiceBean method processFAQueryReportMessage.

@Override
public void processFAQueryReportMessage(@Observes @SetFaQueryMessageEvent ExchangeMessageEvent message) {
    try {
        SetFAQueryMessageRequest request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), SetFAQueryMessageRequest.class);
        log.debug("Got FAQueryMessage in exchange :" + request.getRequest());
        ExchangeLogType exchangeLogType = exchangeLog.log(request, LogType.RECEIVE_FA_QUERY_MSG, ExchangeLogStatusTypeType.ISSUED, TypeRefType.FA_QUERY, request.getRequest(), true);
        String msg = RulesModuleRequestMapper.createSetFaQueryMessageRequest(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 from 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) SetFAQueryMessageRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.SetFAQueryMessageRequest) 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)

Aggregations

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