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
  ...
1
example-broker オブジェクトは、Data Index、Jobs Service、および example-workflow ワークフローによって使用されます。
2
Data Index は、一時設定でデプロイされます。
3
Job Service は、一時設定でデプロイされます。

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-workflowexample-namespaceexample-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
    ...
1
example-workflow 発信イベントは、example-workflow-sb という名前の SinkBinding を使用して生成されます。
2
タイプ in-event-type1 のイベントは、example-workflow-inevent1-b40c067c-595b-4913-81a4-c8efa980bc11 トリガーを使用して消費されます。
3
タイプ in-event-type2 のイベントは、example-workflow-inevent2-b40c067c-595b-4913-81a4-c8efa980bc11 トリガーを使用して消費されます。

以下のコマンドを使用して、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

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.