重要
このページの日本語コンテンツは古くなっている可能性があります。最新の英語版コンテンツをご覧になるには、こちらをクリックしてください。
Salesforce CDC Source Connector for Confluent Cloud¶
注釈
Confluent Platform 用にコネクターをローカルにインストールする場合は、「Salesforce Change Data Capture Source Connector for Confluent Platform」を参照してください。
Kafka Connect Salesforce Change Data Capture (CDC) Source Connector Confluent Cloud を使用すると、Salesforce レコードをモニタリングすることができます。create、update、delete、または undelete 操作の一環として Salesforce レコードに変更が生じると、Salesforce は通知を送信します。Salesforce CDC Source Connector を使用すると、それらの変更イベントをキャプチャーして Apache Kafka® トピックに書き込むことができます。
機能¶
Salesforce CDC Source Connector には、以下の機能が備わっています。
- Salesforce Streaming API: このコネクターは Salesforce Streaming API(変更データキャプチャー) を使用します。キャプチャーされる変更には、新規レコード、既存レコードのアップデート、レコードの削除、およびレコードの復元が含まれます。
- 初期開始: 最新の変更、または 24 時間以内のすべての変更をキャプチャーします。
- Data formats: The connector supports Avro, JSON Schema, Protobuf, JSON (schemaless), or SF_API output data. In SF_API format the record is formatted identically to the Salesforce message received by the connector and the messages are ingested as raw bytes without any schema. Schema Registry must be enabled to use a スキーマレジストリ-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf). See スキーマレジストリ Enabled Environments for additional information.
- トピックの自動作成: このコネクターは Kafka トピックを自動的に作成できます。
- コネクターあたりのタスク数: 組織では複数のコネクターを実行できますが、コネクターあたり 1 つのタスク(
"tasks.max": "1"
)という制限があります。
Connect 用の Confluent Cloud API の使用に関する詳細とサンプルについては、「Confluent Cloud API for Connect」セクションを参照してください。
制限¶
以下の情報を確認してください。
- コネクターの制限事項については、Salesforce CDC Source Connector の制限事項を参照してください。
- 1 つ以上の Single Message Transforms(SMT)を使用する場合は、「SMT の制限」を参照してください。
- Confluent Cloud Schema Registry を使用する場合は、「スキーマレジストリ Enabled Environments」を参照してください。
クイックスタート¶
このクイックスタートを使用して、Salesforce CDC Source Connector の利用を開始することができます。クイックスタートでは、コネクターを選択し、変更をモニタリングするようにコネクターを構成するための基本的な方法を示します。
- 前提条件
- アマゾンウェブサービス (AWS)、Microsoft Azure (Azure)、または Google Cloud Platform (GCP)上の Confluent Cloud クラスターへのアクセスを許可されていること。
- Confluent CLI がインストールされ、クラスター用に構成されていること。「Confluent CLI のインストール」を参照してください。
- スキーマレジストリ ベースのフォーマット(Avro、JSON_SR(JSON スキーマ)、Protobuf など)を使用するには、Schema Registry を有効にしておく必要があります。詳細については、「スキーマレジストリ Enabled Environments」を参照してください。
- Salesforce に CDC を構成しておく必要があります。『Salesforce Change Data Capture Developer Guide』を参照してください。
- コネクター用に構成された Salesforce ユーザーアカウントには、View All Data (すべてのデータを表示)のアクセス許可が必要です。詳細については、「Required Permissions for Change Events Received by CometD Subscribers」を参照してください。
- ネットワークに関する考慮事項については、「Networking and DNS Considerations」を参照してください。静的なエグレス IP を使用する方法については、「静的なエグレス IP アドレス」を参照してください。
- Kafka クラスターの認証情報。次のいずれかの方法で認証情報を指定できます。
- 既存の サービスアカウント のリソース ID を入力する。
- コネクター用の Confluent Cloud サービスアカウント を作成します。「サービスアカウント」のドキュメントで、必要な ACL エントリを確認してください。一部のコネクターには固有の ACL 要件があります。
- Confluent Cloud の API キーとシークレットを作成する。キーとシークレットを作成するには、confluent api-key create を使用するか、コネクターのセットアップ時に Cloud Console で直接 API キーとシークレットを自動生成します。
Confluent Cloud Console の使用¶
ステップ 1: Confluent Cloud クラスターを起動します。¶
インストール手順については、「Quick Start for Confluent Cloud」を参照してください。
ステップ 2: コネクターを追加します。¶
左のナビゲーションメニューの Data integration をクリックし、Connectors をクリックします。クラスター内に既にコネクターがある場合は、+ Add connector をクリックします。
ステップ 3: コネクターを選択します。¶
Click the Salesforce CDC Source connector card.
重要
コネクターを作成する前に、Confluent Cloud クラスター上にトピックが 1 つ以上存在している必要があります。
Step 4: Enter the connector details.¶
注釈
- すべての 前提条件 を満たしていることを確認してください。
- アスタリスク ( * ) は必須項目であることを示しています。
At the Add Salesforce CDC Source Connector screen, complete the following:
- Select the way you want to provide Kafka Cluster credentials. You can
choose one of the following options:
- Global Access: Allows your connector to access everything you have access to. With global access, connector access will be linked to your account. This option is not recommended for production.
- Granular access: Limits the access for your connector. You will be able to manage connector access through a service account. This option is recommended for production.
- Use an existing API key: Allows you to enter an API key and secret part you have stored. You can enter an API key and secret (or generate these in the Cloud Console).
- Click Continue.
- Add the Salesforce connection and authentication details:
- Salesforce instance: The URL of the Salesforce endpoint to use. The default is https://login.salesforce.com. This directs the connector to use the endpoint specified in the authentication response.
- Salesforce username: The Salesforce username the connector to use.
- Salesforce password: The Salesforce password the connector to use.
- Salesforce password token: The Salesforce security token associated with the username.
- Salesforce consumer key: The consumer key for the OAuth application.
- Salesforce consumer secret: The consumer secret for the OAuth application.
- Salesforce CDC name: The Salesforce Change Data Capture event name to subscribe to.
- Click Continue.
Add the following details:
- Select the output record value format (data going to the Kafka topic): AVRO, JSON, JSON_SR (JSON Schema), or PROTOBUF. Schema Registry must be enabled to use a スキーマレジストリ-based format (for example, Avro, JSON Schema, or Protobuf). For additional information, see スキーマレジストリ Enabled Environments.
- Salesforce Object: The Salesforce object to create topic for.
- Salesforce since:
CreatedDate
after which the records should be pulled. The time is in UTC and has required format:yyyy-MM-dd
.
Show advanced configurations
Salesforce initial start: Specify the initial starting point for the connector. Allowed values are
latest
andall
. The default value islatest
.Max Retry Time in Milliseconds: In case of error when making a request to Salesforce, the connector will retry until this time (in milliseconds) elapses.
Connection Max Message Size: The maximum message size in bytes that is accepted during a poll on the Salesforce streaming endpoint.
Transforms and Predicates: For details, see the Single Message Transforms (SMT) documentation.
For all property values and definitions, see 構成プロパティ .
Click Continue.
Based on the number of topic partitions you select, you will be provided with a recommended number of tasks.
- To change the number of tasks, use the Range Slider to select the desired number of tasks.
- Click Continue.
Verify the connection details by previewing the running configuration.
ちなみに
コネクターの出力のプレビューについては、「コネクターのデータプレビュー」を参照してください。
After you've validated that the properties are configured to your satisfaction, click Launch.
The status for the connector should go from Provisioning to Running.
Step 5: Check the Kafka topic.¶
コネクターが実行中になったら、メッセージが Kafka トピックに取り込まれていることを確認します。
Connect 用の Confluent Cloud API の使用に関する詳細とサンプルについては、「Confluent Cloud API for Connect」セクションを参照してください。
参考
フルマネージド型の Confluent Cloud コネクターが Confluent Cloud ksqlDB でどのように動作するかを示す例については、「Cloud ETL のデモ」を参照してください。この例では、Confluent CLI を使用して Confluent Cloud のリソースを管理する方法についても説明しています。
Confluent CLI の使用¶
以下の手順に従うと、Confluent CLI を使用してコネクターをセットアップし、実行できます。
注釈
- すべての 前提条件 を満たしていることを確認してください。
- コマンド例では Confluent CLI バージョン 2 を使用しています。詳細については、「Confluent CLI v2 への移行 <https://docs.confluent.io/confluent-cli/current/migrate.html#cli-migrate>`__」を参照してください。
重要
コネクターを作成する前に、Confluent Cloud クラスター上にトピックが 1 つ以上存在している必要があります。
ステップ 2: コネクターの必須の構成プロパティを表示します。¶
以下のコマンドを実行して、コネクターの必須プロパティを表示します。
confluent connect plugin describe <connector-catalog-name>
例:
confluent connect plugin describe SalesforceCdcSource
出力例:
Following are the required configs:
connector.class: SalesforceCdcSource
name
kafka.auth.mode
kafka.api.key
kafka.api.secret
kafka.topic
salesforce.username
salesforce.password
salesforce.password.token
salesforce.consumer.key
salesforce.consumer.secret
salesforce.cdc.name
output.data.format
tasks.max
ステップ 3: コネクターの構成ファイルを作成します。¶
コネクター構成プロパティを含む JSON ファイルを作成します。以下の例は、コネクターの必須プロパティを示しています。
{
"connector.class": "SalesforceCdcSource",
"name": "SalesforceCdcSourceConnector_0",
"kafka.auth.mode": "KAFKA_API_KEY",
"kafka.api.key": "****************",
"kafka.api.secret": "****************************************************************",
"kafka.topic": "AccountChangeEvent",
"salesforce.username": "<my-username>",
"salesforce.password": "**************",
"salesforce.password.token": "************************",
"salesforce.consumer.key": "*************************************************************************************",
"salesforce.consumer.secret": "****************************************************************",
"salesforce.cdc.name": "AccountChangeEvent",
"output.data.format": "JSON",
"tasks.max": "1"
}
以下のプロパティ定義に注意してください。
"connector.class"
: コネクターのプラグイン名を指定します。"name"
: 新しいコネクターの名前を設定します。
"kafka.auth.mode"
: 使用するコネクターの認証モードを指定します。オプションはSERVICE_ACCOUNT
またはKAFKA_API_KEY
(デフォルト)です。API キーとシークレットを使用するには、構成プロパティkafka.api.key
とkafka.api.secret
を構成例(前述)のように指定します。サービスアカウント を使用するには、プロパティkafka.service.account.id=<service-account-resource-ID>
に リソース ID を指定します。使用できるサービスアカウントのリソース ID のリストを表示するには、次のコマンドを使用します。confluent iam service-account list
例:
confluent iam service-account list Id | Resource ID | Name | Description +---------+-------------+-------------------+------------------- 123456 | sa-l1r23m | sa-1 | Service account 1 789101 | sa-l4d56p | sa-2 | Service account 2
""kafka.topic"
: Kafka トピック名を入力します。コネクターを起動する前に、トピックが 1 つ以上存在している必要があります。"output.data.format"
: Kafka 出力レコード値のフォーマット(コネクターから送られるデータ)を設定します。指定可能なエントリは、AVRO、JSON_SR、PROTOBUF、または JSON です。スキーマベースのメッセージフォーマット(たとえば、Avro、JSON_SR(JSON スキーマ)、および Protobuf)を使用するには、Confluent Cloud Schema Registry を構成しておく必要があります。"tasks.max"
: このコネクターで使用する タスク の数を入力します。組織では複数のコネクターを実行できますが、コネクターあたり 1 つのタスク("tasks.max": "1"
)という制限があります。
Single Message Transforms: CLI を使用する SMT の追加の詳細については、Single Message Transforms(SMT) のドキュメントを参照してください。
すべてのプロパティの値と定義については、「構成プロパティ」を参照してください。
ステップ 4: プロパティファイルを読み込み、コネクターを作成します。¶
以下のコマンドを入力して、構成を読み込み、コネクターを起動します。
confluent connect create --config <file-name>.json
例:
confluent connect create --config salesforce-cdc-source.json
出力例:
Created connector SalesforceCdcSourceConnector_0 lcc-ix4dl
ステップ 5: コネクターのステータスを確認します。¶
以下のコマンドを入力して、コネクターのステータスを確認します。
confluent connect list
出力例:
ID | Name | Status | Type
+-----------+----------------------------------+---------+-------+
lcc-ix4dl | SalesforceCdcSourceConnector_0 | RUNNING | source
ステップ 6: Kafka トピックを確認します。¶
コネクターが実行中になったら、メッセージが Kafka トピックに取り込まれていることを確認します。
Connect 用の Confluent Cloud API の使用に関する詳細とサンプルについては、「Confluent Cloud API for Connect」セクションを参照してください。
構成プロパティ¶
このコネクターでは、以下のコネクター構成プロパティを使用します。
データへの接続方法(How should we connect to your data?)¶
name
コネクターの名前を設定します。
- 型: string
- 指定可能な値: 最大 64 文字の文字列
- 重要度: 高
Kafka クラスターの認証情報(Kafka Cluster credentials)¶
kafka.auth.mode
Kafka の認証モード。KAFKA_API_KEY または SERVICE_ACCOUNT を指定できます。デフォルトは KAFKA_API_KEY モードです。
- 型: string
- デフォルト: KAFKA_API_KEY
- 指定可能な値: KAFKA_API_KEY、SERVICE_ACCOUNT
- 重要度: 高
kafka.api.key
- 型: password
- 重要度: 高
kafka.service.account.id
Kafka クラスターとの通信用の API キーを生成するために使用されるサービスアカウント。
- 型: string
- 重要度: 高
kafka.api.secret
- 型: password
- 重要度: 高
データの送信先トピック(Which topic do you want to send data to?)¶
kafka.topic
データの書き込み先トピック名を指定します。
- 型: string
- 重要度: 高
Salesforce への接続方法(How should we connect to Salesforce?)¶
salesforce.instance
使用する Salesforce エンドポイントの URL。デフォルトは https://login.salesforce.com です。これにより、コネクターは、認証応答の中で指定されたエンドポイントを使用します。
- 型: string
- デフォルト: https://login.salesforce.com
- 重要度: 高
salesforce.username
コネクターで使用される Salesforce ユーザー名。
- 型: string
- 重要度: 高
salesforce.password
コネクターで使用される Salesforce パスワード。
- 型: password
- 重要度: 高
salesforce.password.token
ユーザー名に関連付けられた Salesforce セキュリティトークン。
- 型: password
- 重要度: 高
salesforce.consumer.key
OAuth アプリケーションのコンシューマーキー。
- 型: password
- 重要度: 高
salesforce.consumer.secret
OAuth アプリケーションのコンシューマーシークレット。
- 型: password
- 重要度: 高
salesforce.cdc.name
サブスクライブ先の Salesforce 変更データキャプチャーイベント名。
- 型: string
- 重要度: 高
接続の詳細(Connection details)¶
salesforce.initial.start
イベントを再生する際のコネクターの初期開始点を指定します。
- 型: string
- デフォルト: latest
- 重要度: 高
connection.timeout
Salesforce ストリーミングエンドポイントに接続する際の待機時間をミリ秒で指定します。
- 型: long
- デフォルト: 30000
- 重要度: 低
request.max.retries.time.ms
Salesforce へのリクエストの実行中にエラーが発生した場合は、この時間(ミリ秒)が経過するまで、コネクターにより再試行されます。デフォルト値は 30000(30 秒)です。最小値は 1 秒です。
- 型: long
- デフォルト: 30000(30 秒)
- 指定可能な値: [1000,…,250000]
- 重要度: 低
connection.max.message.size
Salesforce ストリーミングエンドポイントでのロングポーリング中に受け入れられるバイト単位の最大メッセージサイズ。
- 型: int
- デフォルト: 1048576
- 指定可能な値: [1048576,...,104857600]
- 重要度: 低
出力メッセージ¶
output.data.format
Sets the output Kafka record value format. Valid entries are AVRO, JSON_SR, PROTOBUF, JSON or SF_API. Note that you need to have Confluent Cloud Schema Registry configured if using a schema-based message format like AVRO, JSON_SR, and PROTOBUF. When SF_API is selected, the record will be identical in format to the salesforce message as received by the connector. Note that in SF_API, messages are ingested as raw bytes without any schema.
- 型: string
- 重要度: 高
convert.changed.fields
ChangeEventHeader の変更されたフィールドセクション内のフィールド名を変換して、Kafka レコードに存在するフィールド名に一致させるかどうかを指定します。
- 型: boolean
- デフォルト: false
- 重要度: 低
このコネクターのタスク数(Number of tasks for this connector)¶
tasks.max
- 型: int
- 指定可能な値: [1,…,1]
- 重要度: 高
次のステップ¶
参考
フルマネージド型の Confluent Cloud コネクターが Confluent Cloud ksqlDB でどのように動作するかを示す例については、「Cloud ETL のデモ」を参照してください。この例では、Confluent CLI を使用して Confluent Cloud のリソースを管理する方法についても説明しています。