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.22.3. 使用方法
このセクションでは、ceph-source
を使用する方法を説明します。
22.3.1. Knative ソース
ceph-source
Kamelet を Knative オブジェクトにバインドすることで、Knative ソースとして使用することができます。
ceph-source-binding.yaml
apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: ceph-source-binding spec: source: ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: ceph-source properties: accessKey: "The Access Key" bucketName: "The Bucket Name" cephUrl: "http://ceph-storage-address.com" secretKey: "The Secret Key" zoneGroup: "The Bucket Zone Group" sink: ref: kind: Channel apiVersion: messaging.knative.dev/v1 name: mychannel
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: ceph-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: ceph-source
properties:
accessKey: "The Access Key"
bucketName: "The Bucket Name"
cephUrl: "http://ceph-storage-address.com"
secretKey: "The Secret Key"
zoneGroup: "The Bucket Zone Group"
sink:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
22.3.1.1. 前提条件
接続先の OpenShift クラスターに "Red Hat Integration - Camel K" がインストールされていることを確認します。
22.3.1.2. クラスター CLI の使用手順
-
ceph-source-binding.yaml
ファイルをローカルドライブに保存してから、設定に合わせて編集します。 以下のコマンドを使用してソースを実行します。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc apply -f ceph-source-binding.yaml
oc apply -f ceph-source-binding.yaml
22.3.1.3. Kamel CLI を使用するための手順
以下のコマンドを使用してソースを設定および実行します。
kamel bind ceph-source -p "source.accessKey=The Access Key" -p "source.bucketName=The Bucket Name" -p "source.cephUrl=http://ceph-storage-address.com" -p "source.secretKey=The Secret Key" -p "source.zoneGroup=The Bucket Zone Group" channel:mychannel
kamel bind ceph-source -p "source.accessKey=The Access Key" -p "source.bucketName=The Bucket Name" -p "source.cephUrl=http://ceph-storage-address.com" -p "source.secretKey=The Secret Key" -p "source.zoneGroup=The Bucket Zone Group" channel:mychannel
このコマンドは、クラスターの現在の namespace に KameletBinding を作成します。
22.3.2. Kafka Source
ceph-source
Kamelet を Kafka トピックにバインドすることにより、Kafka ソースとして使用できます。
ceph-source-binding.yaml
apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: ceph-source-binding spec: source: ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: ceph-source properties: accessKey: "The Access Key" bucketName: "The Bucket Name" cephUrl: "http://ceph-storage-address.com" secretKey: "The Secret Key" zoneGroup: "The Bucket Zone Group" sink: ref: kind: KafkaTopic apiVersion: kafka.strimzi.io/v1beta1 name: my-topic
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: ceph-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: ceph-source
properties:
accessKey: "The Access Key"
bucketName: "The Bucket Name"
cephUrl: "http://ceph-storage-address.com"
secretKey: "The Secret Key"
zoneGroup: "The Bucket Zone Group"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
22.3.2.1. 前提条件
AMQ Streams Operator を OpenShift クラスターにインストールし、現在の namespace に my-topic
という名前のトピックを作成していることを確認します。接続先の OpenShift クラスターに "Red Hat Integration - Camel K" がインストールされていることを確認します。
22.3.2.2. クラスター CLI の使用手順
-
ceph-source-binding.yaml
ファイルをローカルドライブに保存してから、設定に合わせて編集します。 以下のコマンドを使用してソースを実行します。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc apply -f ceph-source-binding.yaml
oc apply -f ceph-source-binding.yaml
22.3.2.3. Kamel CLI を使用するための手順
以下のコマンドを使用してソースを設定および実行します。
kamel bind ceph-source -p "source.accessKey=The Access Key" -p "source.bucketName=The Bucket Name" -p "source.cephUrl=http://ceph-storage-address.com" -p "source.secretKey=The Secret Key" -p "source.zoneGroup=The Bucket Zone Group" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
kamel bind ceph-source -p "source.accessKey=The Access Key" -p "source.bucketName=The Bucket Name" -p "source.cephUrl=http://ceph-storage-address.com" -p "source.secretKey=The Secret Key" -p "source.zoneGroup=The Bucket Zone Group" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
このコマンドは、クラスターの現在の namespace に KameletBinding を作成します。