use of org.springframework.jms.annotation.JmsListener in project ORCID-Source by ORCID.
the class RetryListener method processMessage.
/**
* Processes messages on receipt.
*
* @param map
* @throws JsonProcessingException
* @throws JAXBException
* @throws AmazonClientException
*/
@JmsListener(destination = MessageConstants.Queues.RETRY)
public void processMessage(final Map<String, String> map) throws JsonProcessingException, AmazonClientException, JAXBException {
RetryMessage message = new RetryMessage(map);
String orcid = message.getOrcid();
if (message.getMap() == null || message.getMap().get(RetryMessage.BROKER_NAME) == null) {
throw new MissingResourceException("Unable to find destination broker", String.class.getName(), RetryMessage.BROKER_NAME);
}
AvailableBroker destinationBroker = AvailableBroker.fromValue(message.getMap().get(RetryMessage.BROKER_NAME));
LOG.info("Recieved " + MessageConstants.Queues.RETRY + " message for orcid " + orcid + " to broker " + destinationBroker);
if (AvailableBroker.DUMP_STATUS_1_2_API.equals(destinationBroker) || AvailableBroker.DUMP_STATUS_2_0_API.equals(destinationBroker)) {
s3Processor.accept(message);
} else if (AvailableBroker.SOLR.equals(destinationBroker)) {
solrProcessor.accept(message);
}
}
use of org.springframework.jms.annotation.JmsListener in project ORCID-Source by ORCID.
the class UpdatedOrcidListener method processMessage.
/**
* Queues incoming messages for processing, eventually handled by UpdatedOrcidWorker
*
* @param map
*/
@JmsListener(destination = MessageConstants.Queues.UPDATED_ORCIDS)
public void processMessage(final Map<String, String> map) {
LastModifiedMessage message = new LastModifiedMessage(map);
LOG.info("Recieved " + MessageConstants.Queues.UPDATED_ORCIDS + " message for orcid " + message.getOrcid() + " " + message.getLastUpdated());
LastModifiedMessage existingMessage = cacheQueue.getCache().getIfPresent(message.getOrcid());
if (existingMessage == null || message.getLastUpdated().after(existingMessage.getLastUpdated()))
cacheQueue.getCache().put(message.getOrcid(), message);
}
use of org.springframework.jms.annotation.JmsListener in project ORCID-Source by ORCID.
the class ReIndexListener method processMessage.
/**
* Processes messages on receipt.
*
* @param map
* @throws JsonProcessingException
* @throws JAXBException
* @throws AmazonClientException
*/
@JmsListener(destination = MessageConstants.Queues.REINDEX)
public void processMessage(final Map<String, String> map) throws JsonProcessingException, AmazonClientException, JAXBException {
LastModifiedMessage message = new LastModifiedMessage(map);
String orcid = message.getOrcid();
LOG.info("Recieved " + MessageConstants.Queues.REINDEX + " message for orcid " + orcid + " " + message.getLastUpdated());
s3Processor.accept(message);
solrProcessor.accept(message);
}
Aggregations