49.3. 使用方法

ここでは、salesforce-source の使用方法について説明します。

49.3.1. Knative ソース

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

salesforce-source-binding.yaml

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: salesforce-source-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: salesforce-source
    properties:
      clientId: "The Consumer Key"
      clientSecret: "The Consumer Secret"
      password: "The Password"
      query: "SELECT Id, Name, Email, Phone FROM Contact"
      topicName: "ContactTopic"
      userName: "The Username"
  sink:
    ref:
      kind: Channel
      apiVersion: messaging.knative.dev/v1
      name: mychannel

49.3.1.1. 前提条件

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

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

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

    oc apply -f salesforce-source-binding.yaml

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

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

kamel bind salesforce-source -p "source.clientId=The Consumer Key" -p "source.clientSecret=The Consumer Secret" -p "source.password=The Password" -p "source.query=SELECT Id, Name, Email, Phone FROM Contact" -p "source.topicName=ContactTopic" -p "source.userName=The Username" channel:mychannel

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