@SuppressWarnings({"unchecked"}) private void handle(ObservableQueue queue, Message msg) { try { executionService.addMessage(queue.getName(), msg); String event = queue.getType() + ":" + queue.getName(); logger.debug("Evaluating message: {} for event: {}", msg.getId(), event); List<EventExecution> transientFailures = executeEvent(event, msg); if (transientFailures.isEmpty()) { queue.ack(Collections.singletonList(msg)); } else if (queue.rePublishIfNoAck()) { // re-submit this message to the queue, to be retried later // This is needed for queues with no unack timeout, since messages are removed from the queue queue.publish(Collections.singletonList(msg)); } } catch (Exception e) { logger.error("Error handling message: {} on queue:{}", msg, queue.getName(), e); } finally { Monitors.recordEventQueueMessagesHandled(queue.getType(), queue.getName()); } }
@SuppressWarnings({"unchecked"}) private void handle(ObservableQueue queue, Message msg) { try { executionService.addMessage(queue.getName(), msg); String event = queue.getType() + ":" + queue.getName(); logger.debug("Evaluating message: {} for event: {}", msg.getId(), event); List<EventExecution> transientFailures = executeEvent(event, msg); if (transientFailures.isEmpty()) { queue.ack(Collections.singletonList(msg)); } else if (queue.rePublishIfNoAck()) { // re-submit this message to the queue, to be retried later // This is needed for queues with no unack timeout, since messages are removed from the queue queue.publish(Collections.singletonList(msg)); } } catch (Exception e) { logger.error("Error handling message: {} on queue:{}", msg, queue.getName(), e); } finally { Monitors.recordEventQueueMessagesHandled(queue.getType(), queue.getName()); } }