Search in sources :

Example 1 with AvailableBroker

use of org.orcid.listener.persistence.util.AvailableBroker in project ORCID-Source by ORCID.

the class S3MessageProcessor method accept.

public void accept(RetryMessage m) {
    String orcid = m.getOrcid();
    AvailableBroker destinationBroker = AvailableBroker.fromValue(m.getMap().get(RetryMessage.BROKER_NAME));
    if (AvailableBroker.DUMP_STATUS_1_2_API.equals(destinationBroker)) {
        update_1_2_API(orcid);
    } else if (AvailableBroker.DUMP_STATUS_2_0_API.equals(destinationBroker)) {
        update_2_0_API(orcid);
    }
}
Also used : AvailableBroker(org.orcid.listener.persistence.util.AvailableBroker)

Example 2 with AvailableBroker

use of org.orcid.listener.persistence.util.AvailableBroker 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);
    }
}
Also used : AvailableBroker(org.orcid.listener.persistence.util.AvailableBroker) MissingResourceException(java.util.MissingResourceException) RetryMessage(org.orcid.utils.listener.RetryMessage) JmsListener(org.springframework.jms.annotation.JmsListener)

Aggregations

AvailableBroker (org.orcid.listener.persistence.util.AvailableBroker)2 MissingResourceException (java.util.MissingResourceException)1 RetryMessage (org.orcid.utils.listener.RetryMessage)1 JmsListener (org.springframework.jms.annotation.JmsListener)1