骆驼Jira Producer如何回复工单?

How do I respond to tickets with camel Jira Producer?

我正在按照此处的示例进行操作 -> https://github.com/apache/camel-k-examples。致力于 05-knative-source-jira

当 运行 集成此集成时,我能够很好地读取和记录新的 jira 问题,当我尝试使用票证中的信息或使用 jira addComment 制作人.

我试过为 IssueKey 选项输入一个静态票号,但我遇到了构建错误,甚至无法让制作人进入 运行。

我试过修改 URI...

示例:将 URI 更改为 -> .to("jira://addComment?IssueKey=EQ-7") returns 下面的构建

No signature of method: org.apache.camel.builder.ValueBuilder.to() is applicable for argument types: (String) values: [jira://addComment&IssueKey=EQ-7]

我已经对 ?& 都进行了尝试,并向 URI 添加了具有类似结果的属性。

我觉得我遗漏了一些非常基本的东西,因此非常感谢任何文档指针。

此处完全集成

// camel-k: language=groovy

from('knative:channel/jira')
  .unmarshal()
  .json()
  .log('Recieved:  ${body}')
  .to('direct:ticket')

from("direct:ticket")
  .setBody().simple("testing")
  .to("jira://addComment?IssueKey=EQ-7")

我最终整理了足够多的文档以找到答案。我将只为可能发现此内容的其他人分享详细信息(或者如果我再次 google)。

关键是

a) 设置 required headers for the issue key. Seting headers examples

b) 确保我的属性设置正确。我使用 a configmap to set my properties, and then referenced them as shown below in the URI. I believe this should also be possible through DSL 但 URI 对我来说最容易开始工作。

下方功能整合。

from("direct:ticket")
  .setHeader("IssueKey").simple('${body["key"]}')
  .setBody().simple("We've recieved the ticket -- we'll update you soon!")
  .to("jira://addComment?jiraUrl={{url}}&consumerKey={{consumer_key}}&accessToken={{access_token}}&privateKey={{private_key}}&verificationCode={{verification_code}}")