/**
   * Constructs the consumer which will read from the given destination and is a child of the given
   * context.
   *
   * @param destination the destination that this consumer will read from
   * @param hazelcastMQContext the parent context of this consumer
   */
  DefaultHazelcastMQConsumer(String destination, DefaultHazelcastMQContext hazelcastMQContext) {
    super();

    this.destination = destination;
    this.receiveLock = new ReentrantLock();
    this.receiveCondition = receiveLock.newCondition();
    this.closed = false;
    this.active = false;

    this.hazelcastMQContext = hazelcastMQContext;
    this.config = hazelcastMQContext.getHazelcastMQInstance().getConfig();

    HazelcastInstance hazelcast =
        this.hazelcastMQContext.getHazelcastMQInstance().getConfig().getHazelcastInstance();

    IdGenerator idGenerator = hazelcast.getIdGenerator("hazelcastmqconsumer");
    this.id = "hazelcastmqconsumer-" + String.valueOf(idGenerator.newId());
  }