Reputation: 21
I want to build an Apache camel application to download a Jira issue report, parse it, and store it into a .csv file. I'm new at Apache camel, I do believe the jira here should be an endpoint, how to setup this configuration, I want to set is as from:("Jira") to (csv file). I believe it could be something like this:
public void configure() throws Exception {
from("jira://pullRequestComment?ProjectKey=CAMEL-0000&IssueTypeId=1&IssueSummary=title")
.process(new MyLogProcessor())
.bean(new MyTransformer(),"transformContent")
.to("file:D:/camel/output");
}
I tried the above code, I got an exception for java conversion type.
Exception:
Upvotes: 1
Views: 831
Reputation: 654
The pullRequestComment
endpoint is for a producer endpoint (i.e. it can only go in to("jira:pullRequestComment?...")
. Since you want to poll for new comments, you should use the newComment
endpoint. So your route would look something like:
from("jira:newComment?serverUrl={host}&username={username}password={password}")
.process(new MyLogProcessor())
.bean(new MyTransformer(),"transformContent")
.to("file:D:/camel/output");
Note that this endpoint returns an object of type com.atlassian.jira.rest.client.domain.Comment
, so in MyLogProcessor
if you do exchange.getIn().getBody()
, it will return an object of type Comment
(or maybe a List if there are multiple objects, you'll have to test this).
If you want to post a pull request comment, then you can use the pullRequestComment
endpoint like the following:
from("direct://some/uri/name")
.header("ProjectKey", "CAMEL-0000")
.header("IssueTypeId", 1L)
.header("IssueSummary", "title")
.to("jira:pullRequestComment?serverUrl={host}&username={username}password={password}")
.... // More processing here
Then if you invoke the route from("direct://some/uri/name")
, it should post the comment that's in the exchange body.
Upvotes: 1
Reputation: 4316
The JIRA component returns Java objects from the JIRA REST API. You need to either:
BTW- The JIRA component caches "seen" data to know what is "new" to pass into the route. For really busy JIRA servers, this looks and acts like a memory leak so you'll need to be mindful to manage that scenario
Upvotes: 1