private Runnable createConsumer(final CloudNode cloudNode) {
        return () -> {
            logger.info("Consumer thread started.");
            while (!this.isMaster(cloudNode)) {
                try {
                    final String task = HazelcastHelper.this.getTaskQueue().take();
                    logger.info("Retrieved task: {}", task);
                    Thread.sleep(RandomUtils.nextInt(2500, 7000));
                    logger.info("Finished task: {}", task);
                } catch (final Exception ex) {
                    logger.error("Exception occurred!", ex);
                }
            }
        };
    }