Chapter 26. Configuring KIE Server to send information to ElasticSearch when a transaction is committed You can configure KIE Server to send information to ElasticSearch automatically. In this case, KIE Server writes an ElasticSearch index entry every time a task, process, case, or variable is created, updated, or deleted. The index entry contains information about the modified object. KIE Server writes the index entry when it commits the transaction with the change. You can use this functionality with any business process or case. You do not need to change anything in the process design. This configuration is also available if you run your process service using Spring Boot. KIE Server serializes the process, case, and task information as JSON documents. It uses the following ElasticSearch indexes: processes for process information cases for case information tasks for task information Prerequisites You created a business process or a case. For more information about creating a business process or case, see Developing process services in Red Hat Process Automation Manager . Procedure To enable sending information to ElasticSearch, complete one of the following steps: If you deployed KIE Server on Red Hat JBoss EAP or another application server, complete the following steps: Download the rhpam-7.13.5-maven-repository.zip product deliverable file from the Software Downloads page of the Red Hat Customer Portal. Extract the contents of the file. Copy the maven-repository/org/jbpm/jbpm-event-emitters-elasticsearch/7.67.0.Final-redhat-00024/jbpm-event-emitters-elasticsearch-7.67.0.Final-redhat-00024.jar file into the deployments/kie-server.war/WEB-INF/lib subdirectory of the application server. If you deployed the application using Spring Boot, add the following lines to the <dependencies> list in the pom.xml file of your service: <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-event-emitters-elasticsearch</artifactId> <version>USD{version.org.kie}</version> </dependency> Configure any of the following KIE Server system properties as necessary: org.jbpm.event.emitters.elasticsearch.url : The URL of the ElasticSearch server. The default value is http://localhost:9200 . org.jbpm.event.emitters.elasticsearch.date_format : The timestamp format for the information. The default value is yyyy-MM-dd'T'HH:mm:ss.SSSZ . org.jbpm.event.emitters.elasticsearch.user : The user name for authenticating to the ElasticSearch server. org.jbpm.event.emitters.elasticsearch.password : The password for authenticating the user to the ElasticSearch server. org.jbpm.event.emitters.elasticsearch.ignoreNull : If this property is true , null values are not written into the JSON output for ElasticSearch. 26.1. Customizing data for ElasticSearch You can develop transformer classes to customize the data that Red Hat Process Automation Manager sends to ElasticSearch. Information about processes, cases, tasks, and task operations is available as views . Red Hat Process Automation Manager includes the following view types: CaseInstanceView ProcessInstanceView TaskInstanceView TaskOperationView You can see the definitions of these views in the GitHub repository . Each view has a getCompositeId() method that returns an identifier. This identifier denotes a particular instance of a case, process, task, or task operation. Each time a process, case, task, or task operation is created, updated, or deleted, the process engine calls a transformer and supplies the relevant view. The transformer must generate an ESRequest object. In the parameters of the constructor of this object, the transformer must supply the necessary information for the ElasticSearch request, including the index. The definitions of the transformer classes and the ESRequest class are available in the GitHub repository . To create and use custom transformers, complete the following procedure. Procedure Create the Java source code for the following classes: ESInstanceViewTransformer : The transformer class. It provides index() and update() methods. Both of the methods take a view as a parameter and return an ESRequest object. When a process, case, task, or task operation instance is first created, the process engine calls the index() method. For subsequent changes related to the same instance, the process engine calls the update() method. You can create different ESInstanceViewTransformer implementations for different view types. ESInstanceViewTransformerFactory : The transformer factory class. It returns an instance of the ESInstanceViewTransformer class for every view type. In Business Central, enter your project and click the Settings Dependencies tab. Optional: Add any dependencies that your transformer classes require. Click the Assets tab. For each of the class source files, complete the following steps: Click Import Asset . In the Please select a file to upload field, select the location of the Java source file for the custom serializer class. Click Ok to upload the file. For the KIE Server instance that runs the service, set the org.jbpm.event.emitters.elasticsearch.factory system property to the fully qualified class name of your implementation of ESInstanceViewTransformerFactory .

Commands:
<dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-event-emitters-elasticsearch</artifactId> <version>USD{version.org.kie}</version> </dependency>