Red Hat Camel K is deprecated
Red Hat Camel K is deprecated and the End of Life date for this product is June 30, 2025. For help migrating to the current go-to solution, Red Hat build of Apache Camel, see the Migration Guide.33.3. 使用方法
ここでは、kafka-sink
の使用方法について説明します。
33.3.1. Knative Sink
kafka-sink
Kamelet を Knative のオブジェクトにバインドすることで、Knative のシンクとして使用することができます。
kafka-sink-binding.yaml
apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: kafka-sink-binding spec: source: ref: kind: Channel apiVersion: messaging.knative.dev/v1 name: mychannel sink: ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: kafka-sink properties: bootstrapServers: "The Brokers" password: "The Password" topic: "The Topic Names" user: "The Username"
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: kafka-sink-binding
spec:
source:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: kafka-sink
properties:
bootstrapServers: "The Brokers"
password: "The Password"
topic: "The Topic Names"
user: "The Username"
33.3.1.1. 前提条件
接続先の OpenShift クラスターにRed Hat Integration - Camel Kがインストールされていることを確認します。
33.3.1.2. クラスター CLI の使用手順
-
kafka-sink-binding.yaml
ファイルをローカルドライブに保存し、必要に応じて設定を編集してください。 以下のコマンドを使用してシンクを実行します。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc apply -f kafka-sink-binding.yaml
oc apply -f kafka-sink-binding.yaml
33.3.1.3. Kamel CLI を使用するための手順
以下のコマンドを使用してシンクを設定し、実行します。
kamel bind channel:mychannel kafka-sink -p "sink.bootstrapServers=The Brokers" -p "sink.password=The Password" -p "sink.topic=The Topic Names" -p "sink.user=The Username"
kamel bind channel:mychannel kafka-sink -p "sink.bootstrapServers=The Brokers" -p "sink.password=The Password" -p "sink.topic=The Topic Names" -p "sink.user=The Username"
このコマンドは、クラスターの現在の namespace に KameletBinding を作成します。