Chapter 20. Sending cloud events from Data Grid clusters

Configure Data Grid as a Knative source by sending CloudEvents to Apache Kafka topics.

Important

Sending cloud events with Red Hat OpenShift Serverless is available as a technology preview feature.

20.1. Technology preview features

Technology preview features or capabilities are not supported with Red Hat production service-level agreements (SLAs) and might not be functionally complete.

Red Hat does not recommend using technology preview features or capabilities for production. These features provide early access to upcoming product features, which enables you to test functionality and provide feedback during the development process.

For more information, see Red Hat Technology Preview Features Support Scope.

20.2. Cloud events

You can send CloudEvents from Data Grid clusters when entries in caches are created, updated, removed, or expired.

Data Grid sends structured events to Kafka in JSON format, as in the following example:

{
    "specversion": "1.0",
    "source": "/infinispan/<cluster_name>/<cache_name>",
    "type": "org.infinispan.entry.created",
    "time": "<timestamp>",
    "subject": "<key-name>",
    "id": "key-name:CommandInvocation:node-name:0",
    "data": {
       "property": "value"
    }
}
FieldDescription

type

Prefixes events for Data Grid cache entries with org.infinispan.entry.

data

Entry value.

subject

Entry key, converted to string.

id

Generated identifier for the event.

20.3. Enabling cloud events

Configure Data Grid to send CloudEvents.

Prerequisites

  • Set up an Kafka cluster that listens for Data Grid topics.

Procedure

  1. Add spec.cloudEvents to your Infinispan CR.

    1. Configure the number of acknowledgements with the spec.cloudEvents.acks field. Values are "0", "1", or "all".
    2. List Kafka servers to which Data Grid sends events with the spec.cloudEvents.bootstrapServers field.
    3. Specify the Kafka topic for Data Grid events with the spec.cloudEvents.cacheEntriesTopic field.

      spec:
        cloudEvents:
          acks: "1"
          bootstrapServers: my-cluster-kafka-bootstrap_1.<namespace_1>.svc:9092,my-cluster-kafka-bootstrap_2.<namespace_2>.svc:9092
          cacheEntriesTopic: target-topic
  2. Apply your changes.