Search in sources :

Example 1 with CommonListEntityRequest

use of com.odysseusinc.arachne.commons.api.v1.dto.CommonListEntityRequest in project ArachneCentralAPI by OHDSI.

the class BaseDataNodeMessageServiceImpl method getListRequest.

@Override
public CommonListEntityRequest getListRequest(DN dataNode) throws JMSException {
    Map<String, CommonEntityRequestObject> requestMap = new LinkedHashMap<>();
    String requestQueue = getRequestQueueName(MessagingUtils.EntitiesList.getBaseQueue(dataNode));
    ConsumerTemplate consumerTpl = new ConsumerTemplate(destinationResolver, requestQueue, // Give some time for case when new connection to a broker is established
    1000L);
    while (true) {
        ObjectMessage requestMessage = jmsTemplate.execute(consumerTpl, true);
        if (requestMessage == null) {
            break;
        }
        requestMap.put(requestMessage.getJMSCorrelationID(), (CommonEntityRequestObject) requestMessage.getObject());
    }
    return new CommonListEntityRequest(requestMap);
}
Also used : ConsumerTemplate(com.odysseusinc.arachne.commons.service.messaging.ConsumerTemplate) ProducerConsumerTemplate(com.odysseusinc.arachne.commons.service.messaging.ProducerConsumerTemplate) CommonEntityRequestObject(com.odysseusinc.arachne.commons.api.v1.dto.CommonEntityRequestObject) ObjectMessage(javax.jms.ObjectMessage) CommonListEntityRequest(com.odysseusinc.arachne.commons.api.v1.dto.CommonListEntityRequest) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

CommonEntityRequestObject (com.odysseusinc.arachne.commons.api.v1.dto.CommonEntityRequestObject)1 CommonListEntityRequest (com.odysseusinc.arachne.commons.api.v1.dto.CommonListEntityRequest)1 ConsumerTemplate (com.odysseusinc.arachne.commons.service.messaging.ConsumerTemplate)1 ProducerConsumerTemplate (com.odysseusinc.arachne.commons.service.messaging.ProducerConsumerTemplate)1 LinkedHashMap (java.util.LinkedHashMap)1 ObjectMessage (javax.jms.ObjectMessage)1