thisguy123
thisguy123

Reputation: 945

How do I respond to tickets with camel Jira Producer?

I'm following the examples here -> https://github.com/apache/camel-k-examples. Working on 05-knative-source-jira

When running this integration, I'm able to read and log new jira issues just fine, I fall down when I try to use info from the ticket, or respond to the ticket with the jira addComment producer.

I've tried just putting a static ticket number in for the IssueKey option, but I get build errors and can't even get the producer to run.

I've tried tinkering with the URI...

Ex: Changing URI to -> .to("jira://addComment?IssueKey=EQ-7") returns below on build

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

I've tried this with both ? and &, as well as adding properties to the URI with similar results.

I feel like I'm missing something pretty fundamental, so any docs pointers would be well appreciated.

Full integration here

// 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")

Upvotes: 0

Views: 168

Answers (1)

thisguy123
thisguy123

Reputation: 945

I ended up sorting through enough docs to find the answer. I'll share details just for others who might find this (or if I google it again).

The key was to

a) Set the required headers for the issue key. Seting headers examples

b) Ensure that my properties are set correctly. I used 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 but URI was easiest for me to just get working.

Functional Integration below.

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}}")

Upvotes: 0

Related Questions