protected void processQueue() {
        try {
            Collection<EsMetricPayload> batch = new ArrayList<>(this.batchSize);
            EsMetricPayload rm = queue.take();
            batch.add(rm);
            queue.drainTo(batch, this.batchSize - 1);
            if (options.getWriteTo().contains(WriteTo.REMOTE)) {
                writeToEsServer(batch);
            }
            if (options.getWriteTo().contains(WriteTo.LOG)) {
                writeToLogger(batch);
            }
        } catch (InterruptedException ire) {
            LOGGER.error("Unexpected thread interruption in metrics", ire); //$NON-NLS-1$
        }
    }
Process the next item in the queue.
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsMetrics.java