@Override public TrackingQueue.PossessionState recordProgress(String consumerId, String queueName, String elementId, TrackingQueue.ConsumingStatus status, String result) { return queueMap.getUnchecked(queueName).recordProgress(consumerId, elementId, status, result); }
@Override public TrackingQueue.PossessionState recordProgress(String consumerId, String elementId, TrackingQueue.ConsumingStatus status, String result) { return getQueue().recordProgress(consumerId, elementId, status, result); }
@Override public void run() { while (true) { Element element = balanceQueue.take(id); if (element == null) { return; } try { tenantProvisionerService.rebalanceTenantWorkers(element.getValue()); balanceQueue.recordProgress(id, element.getId(), TrackingQueue.ConsumingStatus.FINISHED_SUCCESSFULLY, "balanced"); } catch (CapacityException e) { LOG.error("Not enough capacity trying to balance workers for tenant {}", element.getValue(), e); // a failed status puts the element back in the queue, we don't want to consume this element again. // when another provisioner comes online, workers will get rebalanced once again. balanceQueue.recordProgress(id, element.getId(), TrackingQueue.ConsumingStatus.FINISHED_SUCCESSFULLY, "not enough capacity"); } catch (IOException e) { LOG.error("Exception trying to balance workers for tenant {}", element.getValue(), e); balanceQueue.recordProgress(id, element.getId(), TrackingQueue.ConsumingStatus.FINISHED_SUCCESSFULLY, "failed"); } } } }
queue.recordProgress(consumerName, element.getId(), TrackingQueue.ConsumingStatus.FAILED, null); System.out.println("failed consuming: " + element.getId()); continue; queue.recordProgress(consumerName, element.getId(), TrackingQueue.ConsumingStatus.FINISHED_SUCCESSFULLY, "result-" + element.getId()); System.out.println("posesses: " + state.name() + ", elem: " + element.getId());