Menu Close

Chapter 6. Red Hat build of Kogito events add-on

The events add-on provides a default implementation in supported target platforms for EventEmitter and EventReceiver interfaces. You can use EventEmitter and EventReceiver interfaces to enable messaging by process, serverless workflow events, and event decision handling.

6.1. Implementing message payload decorator for Red Hat build of Kogito events add-on

Any dependent add-on can implement the MessagePayloadDecorator.

Prerequisites

  • You have installed the Events add-on in Red Hat build of Kogito.

Procedure

  1. Create a file named META-INF/services/org.kie.kogito.add-on.cloudevents.message.MessagePayloadDecorator in your class path.
  2. Open the file.
  3. Enter the full name of your implementation class in the file.
  4. Save the file.

    The MessagePayloadDecoratorProvider loads the file upon application start-up and adds the file to the decoration chain. When Red Hat build of Kogito calls the MessagePayloadDecoratorProvider#decorate, your implementation is part of the decoration algorithm.

  5. To use the events add-on, add the following code to the pom.xml file of your project:

    Events smallrye add-on for {QAURKUS}

    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-addons-quarkus-events-smallrye</artifactId>
      <version>1.15</version>
    </dependency>

    Events decisions add-on for {QAURKUS}

    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-addons-events-decisions</artifactId>
      <version>1.15</version>
    </dependency>

    Events Kafka add-on for Spring Boot

    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-addons-springboot-events-kafka</artifactId>
      <version>1.15</version>
    </dependency>

    Events decisions add-on for Spring Boot

    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-addons-springboot-events-decisions</artifactId>
      <version>1.15</version>
    </dependency>