void Consumer::SetListenerCallback()

in src/Consumer.cc [127:140]


void Consumer::SetListenerCallback(MessageListenerCallback *listener) {
  if (this->listener != nullptr) {
    // It is only safe to set the listener once for the lifecycle of the Consumer
    return;
  }

  if (listener != nullptr) {
    listener->consumerPromise.set_value(this);
    // If a consumer listener is set, the Consumer instance is kept alive even if it goes out of scope in JS
    // code.
    this->Ref();
    this->listener = listener;
  }
}