code: public void emitEvent(
        final NamespaceSynchronizationConfig nsConfig,
        final ChangeEvent<BsonDocument> event) {
      listenersLock.lock();
      try {
        if (nsConfig.getNamespaceListenerConfig() == null) {
          return;
        }
        final NamespaceListenerConfig namespaceListener =
            nsConfig.getNamespaceListenerConfig();
        eventDispatcher.dispatch(() -> {
          try {
            if (namespaceListener.getEventListener() != null) {
              namespaceListener.getEventListener().onEvent(
                  BsonUtils.getDocumentId(event.getDocumentKey()),
                  ChangeEvents.transformChangeEventForUser(
                      event, namespaceListener.getDocumentCodec()));
            }
          } catch (final Exception ex) {
            logger.error(String.format(
                Locale.US,
                "emitEvent ns=%s documentId=%s emit exception: %s",
                event.getNamespace(),
                BsonUtils.getDocumentId(event.getDocumentKey()),
                ex), ex);
          }
          return null;
        });
      } finally {
        listenersLock.unlock();
      }
    }
docs: Emits a change event for the given document id.
  
  @param nsConfig   the configuration for the namespace to which the
  document referred to by the change event belongs.
  @param event      the change event.