33.3. 使用
这部分论述了如何使用 jira-add-issue-sink
。
33.3.1. Knative Sink
您可以通过将 jira-add-issue-sink
Kamelet 绑定到 Knative 对象来使用 jira-add-sink Kamelet 作为 Knative sink。
jira-add-issue-sink-binding.yaml
apiVersion: camel.apache.org/v1alpha1 kind: KameletBinding metadata: name: jira-add-issue-sink-binding spec: source: ref: kind: KafkaTopic apiVersion: kafka.strimzi.io/v1beta1 name: my-topic steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: insert-header-action properties: name: "projectKey" value: "MYP" - ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: insert-header-action properties: name: "issueTypeName" value: "Bug" - ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: insert-header-action properties: name: "issueSummary" value: "The issue summary" - ref: kind: Kamelet apiVersion: camel.apache.org/v1alpha1 name: insert-header-action properties: name: "issuePriorityName" value: "Low" sink: ref: kind: Channel apiVersion: messaging.knative.dev/v1 name: mychannel properties: jiraUrl: "jira server url" username: "username" password: "password"
33.3.1.1. 前提条件
确保将 "Red Hat Integration - Camel K" 安装到您连接到的 OpenShift 集群中。
33.3.1.2. 使用集群 CLI 的步骤
-
将
jira-add-issue-sink-binding.yaml
文件保存到本地驱动器中,然后根据需要编辑它。 使用以下命令运行 sink:
oc apply -f jira-add-issue-sink-binding.yaml
33.3.1.3. 使用 Kamel CLI 的步骤
使用以下命令配置并运行 sink:
kamel bind --name jira-add-issue-sink-binding timer-source?message="The new comment"\&period=60000 --step insert-header-action -p step-0.name=projectKey -p step-0.value=MYP --step insert-header-action -p step-1.name=issueTypeName -p step-1.value=Bug --step insert-header-action -p step-2.name=issueSummary -p step-2.value="This is a bug" --step insert-header-action -p step-3.name=issuePriorityName -p step-3.value=Low jira-add-issue-sink?jiraUrl="jira url"\&username="username"\&password="password"
这个命令会在集群的当前命名空间中创建 KameletBinding。