5.3. 使用方法

ここでは、aws-kinesis-source を使用する方法について説明します。

5.3.1. Knative ソース

aws-kinesis-source Kamelet を Knative オブジェクトにバインドすることで、Knative ソースとして使用することができます。

aws-kinesis-source-binding.yaml

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: aws-kinesis-source-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: aws-kinesis-source
    properties:
      accessKey: "The Access Key"
      region: "eu-west-1"
      secretKey: "The Secret Key"
      stream: "The Stream Name"
  sink:
    ref:
      kind: Channel
      apiVersion: messaging.knative.dev/v1
      name: mychannel

5.3.1.1. 前提条件

接続先の OpenShift クラスターにRed Hat Integration - Camel Kがインストールされていることを確認します。

5.3.1.2. クラスター CLI の使用手順

  1. aws-kinesis-source-binding.yaml ファイルをローカルドライブに保存し、設定に合わせて編集します。
  2. 以下のコマンドを使用してソースを実行します。

    oc apply -f aws-kinesis-source-binding.yaml

5.3.1.3. Kamel CLI を使用するための手順

以下のコマンドを使用してソースを設定および実行します。

kamel bind aws-kinesis-source -p "source.accessKey=The Access Key" -p "source.region=eu-west-1" -p "source.secretKey=The Secret Key" -p "source.stream=The Stream Name" channel:mychannel

このコマンドは、クラスターの現在の namespace に KameletBinding を作成します。