use of eu.europa.ec.fisheries.schema.exchange.plugin.v1.ExchangePluginMethod in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method processAcknowledge.
@Override
public void processAcknowledge(@Observes @ExchangeLogEvent ExchangeMessageEvent message) {
log.info("Process acknowledge:{}", message);
try {
AcknowledgeResponse response = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), AcknowledgeResponse.class);
AcknowledgeType acknowledge = response.getResponse();
String serviceClassName = response.getServiceClassName();
ExchangePluginMethod method = response.getMethod();
switch(method) {
case SET_COMMAND:
// Only Acknowledge for poll should have a poll status set
if (acknowledge.getPollStatus() != null && acknowledge.getPollStatus().getPollId() != null) {
handleSetPollStatusAcknowledge(method, serviceClassName, acknowledge);
} else {
handleUpdateExchangeLogAcknowledge(method, serviceClassName, acknowledge);
}
break;
case SET_REPORT:
handleUpdateExchangeLogAcknowledge(method, serviceClassName, acknowledge);
break;
case START:
handleUpdateServiceAcknowledge(serviceClassName, acknowledge, StatusType.STARTED);
pluginStatusEvent.fire(createNotificationMessage(serviceClassName, true));
break;
case STOP:
handleUpdateServiceAcknowledge(serviceClassName, acknowledge, StatusType.STOPPED);
pluginStatusEvent.fire(createNotificationMessage(serviceClassName, false));
break;
case SET_CONFIG:
default:
handleAcknowledge(method, serviceClassName, acknowledge);
break;
}
} catch (ExchangeModelMarshallException e) {
log.error("Process acknowledge couldn't be marshalled {} {}", message, e);
} catch (ExchangeServiceException e) {
// TODO Audit.log() couldn't process acknowledge in exchange service
log.error("Couldn't process acknowledge in exchange service:{} {} ", message, e.getMessage());
}
}
Aggregations