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.58.3. 使用状況
本セクションでは、regex-router-action
の使用方法を説明します。
58.3.1. Knative Action
regex-router-action
Kamelet を Knative バインディングの中間ステップとして使用することができます。
regex-router-action-binding.yaml
apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: regex-router-action-binding spec: source: ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: timer-source properties: message: "Hello" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: regex-router-action properties: regex: "The Regex" replacement: "The Replacement" sink: ref: kind: Channel apiVersion: messaging.knative.dev/v1 name: mychannel
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: regex-router-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: regex-router-action
properties:
regex: "The Regex"
replacement: "The Replacement"
sink:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
58.3.1.1. 前提条件
接続先の OpenShift クラスターにRed Hat Integration - Camel Kがインストールされていることを確認します。
58.3.1.2. クラスター CLI の使用手順
-
regex-router-action-binding.yaml
ファイルをローカルドライブに保存し、設定に合わせて編集します。 以下のコマンドを使用して、アクションを実行します。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc apply -f regex-router-action-binding.yaml
oc apply -f regex-router-action-binding.yaml
58.3.1.3. Kamel CLI を使用するための手順
以下のコマンドを使用して、アクションを設定および実行します。
kamel bind timer-source?message=Hello --step regex-router-action -p "step-0.regex=The Regex" -p "step-0.replacement=The Replacement" channel:mychannel
kamel bind timer-source?message=Hello --step regex-router-action -p "step-0.regex=The Regex" -p "step-0.replacement=The Replacement" channel:mychannel
このコマンドは、クラスターの現在の namespace に KameletBinding を作成します。
58.3.2. Kafka Action
regex-router-action
Kamelet を Kafka バインディングの中間ステップとして使用することができます。
regex-router-action-binding.yaml
apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: regex-router-action-binding spec: source: ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: timer-source properties: message: "Hello" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: regex-router-action properties: regex: "The Regex" replacement: "The Replacement" sink: ref: kind: KafkaTopic apiVersion: kafka.strimzi.io/v1beta1 name: my-topic
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: regex-router-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: regex-router-action
properties:
regex: "The Regex"
replacement: "The Replacement"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
58.3.2.1. 前提条件
AMQ Streams Operator を OpenShift クラスターにインストールし、現在の namespace に my-topic
という名前のトピックを作成していることを確認します。接続先の OpenShift クラスターにRed Hat Integration - Camel Kがインストールされていることを確認します。
58.3.2.2. クラスター CLI の使用手順
-
regex-router-action-binding.yaml
ファイルをローカルドライブに保存し、設定に合わせて編集します。 以下のコマンドを使用して、アクションを実行します。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc apply -f regex-router-action-binding.yaml
oc apply -f regex-router-action-binding.yaml
58.3.2.3. Kamel CLI を使用するための手順
以下のコマンドを使用して、アクションを設定および実行します。
kamel bind timer-source?message=Hello --step regex-router-action -p "step-0.regex=The Regex" -p "step-0.replacement=The Replacement" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
kamel bind timer-source?message=Hello --step regex-router-action -p "step-0.regex=The Regex" -p "step-0.replacement=The Replacement" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
このコマンドは、クラスターの現在の namespace に KameletBinding を作成します。