use of eu.europa.ec.fisheries.uvms.activity.model.schemas.MapToSubscriptionRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method getMapToSubscriptionMessage.
@Override
public void getMapToSubscriptionMessage(@Observes @MapToSubscriptionRequestEvent EventMessage message) {
log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "MapToSubscriptionRequestEvent");
try {
TextMessage jmsMessage = message.getJmsMessage();
String jmsCorrelationID = jmsMessage.getJMSMessageID();
String messageReceived = jmsMessage.getText();
SubscriptionDataRequest subscriptionDataRequest = null;
MapToSubscriptionRequest baseRequest = JAXBUtils.unMarshallMessage(messageReceived, MapToSubscriptionRequest.class);
switch(baseRequest.getMessageType()) {
case FLUX_FA_QUERY_MESSAGE:
FLUXFAQueryMessage fluxfaQueryMessage = JAXBUtils.unMarshallMessage(baseRequest.getRequest(), FLUXFAQueryMessage.class);
subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(fluxfaQueryMessage.getFAQuery());
break;
case FLUX_FA_REPORT_MESSAGE:
FLUXFAReportMessage fluxFAReportMessage = JAXBUtils.unMarshallMessage(baseRequest.getRequest(), FLUXFAReportMessage.class);
subscriptionDataRequest = SubscriptionMapper.mapToSubscriptionDataRequest(fluxFAReportMessage);
break;
default:
sendError(message, new IllegalArgumentException("VERBODEN VRUCHT"));
}
subscriptionProducer.sendMessageWithSpecificIds(JAXBUtils.marshallJaxBObjectToString(subscriptionDataRequest), subscriptionProducer.getDestination(), JMSUtils.lookupQueue(MessageConstants.QUEUE_RULES), null, jmsCorrelationID);
} catch (JAXBException | MessageException | JMSException e) {
sendError(message, e);
}
}
Aggregations