It is possible to write ECAs for specific entities using an Entity Event Condition Action (EECA). For example, to trigger an Event, say a notification Service, when a field in an entity changes, you could write an EECA as we shall see in this recipe.
Triggering a notification Service using EECA can be done by following these steps:
1. If one does not already exist, add an entry in the
ofbiz-component.xml
file to identify the EECA definition file location as shown:<entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/>
2. Create or add an EECA definition file with an XML version declaration and an XML XSD schema declaration, as shown here:
<?xml version="1.0" encoding="UTF-8"?> <entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://ofbiz.apache.org/dtds/entity-eca.xsd">
3. Add one or more EECA definitions to the EECA definition file. Don't...