6.5. イベントシステムへのワークフローのリンク
OpenShift Serverless Logic Operator は、Knative Eventing、SinkBinding、およびトリガーを使用してイベントシステムとワークフローをリンクします。これらのオブジェクトは OpenShift Serverless Logic Operator によって自動的に作成され、ワークフローイベントの生成および消費を単純化します。
以下の例は、プラットフォームスコープのイベントシステムで設定された example-workflow
ワークフロー用に作成された Knative Eventing オブジェクトを示しています。
apiVersion: sonataflow.org/v1alpha08 kind: SonataFlowPlatform metadata: name: sonataflow-platform-example namespace: example-namespace spec: eventing: broker: ref: name: example-broker 1 apiVersion: eventing.knative.dev/v1 kind: Broker services: dataIndex: 2 enabled: true jobService: 3 enabled: true ...
example-broker
オブジェクトは Kafka クラス Broker で、その設定は kafka-broker-config
config map で定義されます。
次の例は、SonataFlowPlatform で使用する Kafka Knative Broker を設定する方法を示しています。
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
annotations:
eventing.knative.dev/broker.class: Kafka 1
name: example-broker
namespace: example-namespace
spec:
config:
apiVersion: v1
kind: ConfigMap
name: kafka-broker-config
namespace: knative-eventing
- 1
- Kafka クラスは、
example-broker
オブジェクトの作成に使用されます。
以下の例は、イベントの生成および消費用に、example-workflow
が example-namespace
の example-broker
に自動的にリンクされる方法を示しています。
apiVersion: sonataflow.org/v1alpha08 kind: SonataFlow metadata: name: example-workflow namespace: example-namespace annotations: sonataflow.org/description: Example Workflow sonataflow.org/version: 0.0.1 sonataflow.org/profile: preview spec: flow: start: ExampleStartState events: - name: outEvent1 source: '' kind: produced type: out-event-type1 1 - name: inEvent1 source: '' kind: consumed type: in-event-type1 2 - name: inEvent2 source: '' kind: consumed type: in-event-type2 3 states: - name: ExampleStartState ...
以下のコマンドを使用して、example-workflow-sb
という名前の自動作成された SinkBinding
をリスト表示できます。
$ oc get sinkbindings -n example-namespace
出力例
NAME TYPE RESOURCE SINK READY example-workflow-sb SinkBinding sinkbindings.sources.knative.dev broker:example-broker True
以下のコマンドを使用して、イベント消費用に自動作成されたトリガーをリスト表示できます。
$ oc get triggers -n <example-namespace>
出力例
NAME BROKER SINK AGE CONDITIONS READY REASON example-workflow-inevent1-b40c067c-595b-4913-81a4-c8efa980bc11 example-broker service:example-workflow 16m 7 OK / 7 True example-workflow-inevent2-b40c067c-595b-4913-81a4-c8efa980bc11 example-broker service:example-workflow 16m 7 OK / 7 True