第 14 章 Red Hat Decision Manager Red Hat build of Kogito Operator 与 Kafka 交互
Red Hat Decision Manager Red Hat build of Kogito Operator 使用 AMQ Streams Operator 自动配置带有 Kafka 的 Kogito 微服务的红帽构建。
当您通过 KogitoInfra
部署启用基础架构机制时,Red Hat Decision Manager Red Hat Decision Manager 红帽构建的 Kogito Operator 会使用相关的第三方操作器来配置基础架构。
您必须定义自定义基础架构资源,并将其链接到 KogitoInfra
文件中。您可以在 spec.resource.name
和 spec.resource.namespace
配置中指定您的自定义基础架构资源。
Red Hat Decision Manager 红帽为自定义消息构建 Kogito 基础架构资源示例
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoInfra # Application type metadata: name: my-kafka-infra spec: resource: apiVersion: kafka.strimzi.io/v1beta2 # AMQ Streams API kind: Kafka # AMQ Streams Application Type name: my-kafka-instance namespace: my-namespace
在本例中,KogitoInfra
自定义资源从 my-namespace
连接到 my-namespace 的 Kafka 集群 my-kafka-instance
,用于事件消息。
要将红帽构建的 Kogito 微服务连接到 Kafka,您需要定义 infra
配置以使用对应的基础架构。
红帽构建带有消息传递的 Kogito 微服务资源配置示例
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name spec: image: <final-image-name> # Kogito image name insecureImageRegistry: true # Can be omitted when image is pushed into secured registry with valid certificate infra: - my-kafka-infra
Red Hat Decision Manager Red Hat build of Kogito Operator 配置必要的属性,以便您的应用程序可以连接到 Kafka 实例。