Search in sources :

Example 1 with ReceiveSalesQueryRequest

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

the class ExchangeEventIncomingServiceBean method receiveSalesQuery.

@Override
public void receiveSalesQuery(@Observes @ReceiveSalesQueryEvent ExchangeMessageEvent event) {
    try {
        ReceiveSalesQueryRequest request = JAXBMarshaller.unmarshallTextMessage(event.getJmsMessage(), ReceiveSalesQueryRequest.class);
        log.info("Process sales query in Exchange module:{}", request);
        String query = request.getQuery();
        PluginType plugin = request.getPluginType();
        String sender = request.getSenderOrReceiver();
        String messageGuid = request.getMessageGuid();
        ExchangeLogType log = exchangeLog.log(request, LogType.RECEIVE_SALES_QUERY, ExchangeLogStatusTypeType.ISSUED, TypeRefType.SALES_QUERY, query, true);
        forwardToRules(RulesModuleRequestMapper.createReceiveSalesQueryRequest(query, messageGuid, plugin.name(), log.getGuid(), sender, request.getOnValue()));
    } catch (ExchangeModelMarshallException e) {
        try {
            firePluginFault(event, "Couldn't map to SalesQueryRequest when processing sales query from plugin. The message was " + event.getJmsMessage().getText(), e);
        } catch (JMSException e1) {
            firePluginFault(event, "Couldn't map to SalesQueryRequest when processing sales query from plugin.", e);
        }
    } catch (ExchangeLogException e) {
        firePluginFault(event, "Could not log the incoming sales query.", e);
    } catch (RulesModelMarshallException e) {
        firePluginFault(event, "Could not create a request for the Rules module for an incoming sales query.", e);
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) RulesModelMarshallException(eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException) ReceiveSalesQueryRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.ReceiveSalesQueryRequest) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) JMSException(javax.jms.JMSException) PluginType(eu.europa.ec.fisheries.schema.exchange.plugin.types.v1.PluginType)

Aggregations

ReceiveSalesQueryRequest (eu.europa.ec.fisheries.schema.exchange.module.v1.ReceiveSalesQueryRequest)1 PluginType (eu.europa.ec.fisheries.schema.exchange.plugin.types.v1.PluginType)1 ExchangeLogType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType)1 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)1 ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)1 RulesModelMarshallException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException)1 JMSException (javax.jms.JMSException)1