ECA: Events - Conditions - Actions Rules Engine Released
ECA stands for "Events - Conditions - Actions" a powerful, versatile, and user-friendly rules engine for Drupal 9+ was released on June 22nd 2022. ECA was created on July 22nd 2021 by Jürgen Haas. The logo of ECA was created by Nico Grienauer and the supporting organizations for this module are LakeDrops and OpenCampus GmbH.
During the recent Drupal Mountain Camp, Jürgen Haas presented on ECA explaining that it was created to reduce the need for custom modules. This was to ease the migration as the old sites used the Rules module. ECA is basically to provide a “Rules” for Drupal 9 and above.
The core module is a processor that validates and executes event-condition-action plugins. Integrated with graphical user interfaces like BPMN.iO, Camunda or other possible future modelers, ECA is a robust system for building conditionally triggered action sets.
Built from scratch in Drupal 9, ECA leverages all the Symfony and Drupal core APIs for events. The module processes any number of ECA models and performs conditional actions on literally anything available inside a Drupal site. From simple field validations, value changes, tampering, sending emails, publishing entities, logging or displaying messages up to more complex models with loops, custom events, caching and stateful actions - ECA provides full access to all of Drupal's power from within a simple and easy-to-use UI.
According to a blog on LakeDrops, ECA was ready for a release candidate a couple of months ago, but it was decided to hold on with the long-awaited RC1 until they felt confident that all the complexity is delivering on the promise to "just work" - and that they can continue working on it without breaking things down the road.
All the code is fully compliant with Drupal's coding standard and well commented. This will make maintenance easier for decades to come.
- Plugin managers for modelers, events, and conditions
- Interfaces and abstract base classes and traits
- Integration of all actions from the Drupal core Actions module and all available contrib modules
- Extensive context stack support (optional with Context Stack)
- Support for caching, loops, logging, states, tokens, etc.
- Prevents recursions
- TypedData support
- Tagging for event characterization
- Models are stored in config, so they can be imported and exported via Drush or the configuration management UI
- Included sub-modules
How it works
ECA gets triggered for every Drupal event. It validates these events against event-condition-action models and processes all the models for the current event. Like Drupal Rules, ECA leverages existing components of Drupal core, which are events and actions. It comes with its own plugin manager for conditions, which results in all three components (events, conditions, actions) being available as plugins that can easily be extended by other modules. ECA models are stored in config, so they can be imported and exported via the admin UI or Drush.
ECA Core is a processing engine that runs in the background. It needs an integrated modeler – a front-end tool with which you define event-condition-action models i.e. the rules. ECA provides a plugin manager with an interface to easily integrate existing tools that already provide that capability. And if the modeler supports templates for events, conditions and actions, ECA will provide them for all the plugins that are available on the current Drupal site.
It is simple to get started with ECA on any existing Drupal 9+ site: download the code with Composer; download your choice of integrated modeler with Composer; enable ECA, the sub-modules you want to use, and the modeler. No further configuration required.