Events

Rules uses the Symfony event dispatching system to trigger events and invoke reaction rules when an event occurs. A module that wants to provide events can do so without having a module dependency to Rules -dispatching standard Symfony events in code is enough.

In order to make an event known to Rules a *.rules.events.yml file has to be
provided to register the event(s). Example from Rules itself:

An instance of the UserLoginEvent class is created, passing along the
account user object as context parameter. The event dispatching service is used
to invoke all event subscribers. Rules itself is among those subscribers with
its GenericEventSubscriber class which will trigger all reaction rules
that are configured for the event.

Note: Do not use \Drupal when invoking events from within a class, use
dependency injection for the event dispatcher service instead.