code: func (ed *Dispatcher) HandleStopAndTransferEvent(e Event) {
  	event := e.(*StopAndTransferEvent)
  
  	logger.Debugf("Stopping dispatcher...")
  	if !ed.setState(dispatcherStateStarted, dispatcherStateStopped) {
  		logger.Warn("Cannot stop event dispatcher since it's already stopped.")
  		event.ErrCh <- errors.New("dispatcher already stopped")
  		return
  	}
  
  	event.SnapshotCh <- ed.newSnapshot()
  
  	// Remove all registrations but don't close the associated event channels
  	ed.clearRegistrations(false)
  }
docs: // HandleStopAndTransferEvent stops the dispatcher and transfers all event registrations
  // into a EventSnapshot.
  // The Dispatcher is no longer usable.