Search in sources :

Example 1 with UpdatePluginSettingRequest

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

the class PluginServiceBean method updatePluginSetting.

@Override
public void updatePluginSetting(@Observes @UpdatePluginSettingEvent ExchangeMessageEvent settingEvent) {
    LOG.info("update plugin setting from module queue:{}", settingEvent);
    try {
        TextMessage jmsMessage = settingEvent.getJmsMessage();
        UpdatePluginSettingRequest request = JAXBMarshaller.unmarshallTextMessage(jmsMessage, UpdatePluginSettingRequest.class);
        updatePluginSetting(request.getServiceClassName(), request.getSetting(), request.getUsername());
        String text = ExchangeModuleResponseMapper.mapUpdateSettingResponse(ExchangeModuleResponseMapper.mapAcknowledgeTypeOK());
        producer.sendModuleResponseMessage(settingEvent.getJmsMessage(), text);
    } catch (ExchangeModelMarshallException | ExchangeServiceException | ExchangeMessageException e) {
        LOG.error("Couldn't unmarshall update setting request");
        settingEvent.setErrorFault(ExchangeModuleResponseMapper.createFaultMessage(FaultCode.EXCHANGE_EVENT_SERVICE, "Couldn't update plugin setting"));
        producer.sendModuleErrorResponseMessage(settingEvent);
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) UpdatePluginSettingRequest(eu.europa.ec.fisheries.schema.exchange.module.v1.UpdatePluginSettingRequest) ExchangeMessageException(eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException) TextMessage(javax.jms.TextMessage) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Aggregations

UpdatePluginSettingRequest (eu.europa.ec.fisheries.schema.exchange.module.v1.UpdatePluginSettingRequest)1 ExchangeMessageException (eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException)1 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)1 ExchangeServiceException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)1 TextMessage (javax.jms.TextMessage)1