You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/05/17 12:10:29 UTC

[camel] 03/03: CAMEL-13390 - Regen docs

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0b37cf589471d3e3c1e12c2c2fa4d2f887ac1aab
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri May 17 13:56:20 2019 +0200

    CAMEL-13390 - Regen docs
---
 .../modules/ROOT/pages/jira-component.adoc         | 284 +++++++++++++++++++++
 1 file changed, 284 insertions(+)

diff --git a/docs/components/modules/ROOT/pages/jira-component.adoc b/docs/components/modules/ROOT/pages/jira-component.adoc
new file mode 100644
index 0000000..0efb3c7
--- /dev/null
+++ b/docs/components/modules/ROOT/pages/jira-component.adoc
@@ -0,0 +1,284 @@
+[[jira-component]]
+== Jira Component
+
+*Available as of Camel version 3.0*
+
+The JIRA component interacts with the JIRA API by encapsulating
+Atlassian's https://bitbucket.org/atlassian/jira-rest-java-client/src/master/[REST
+Java Client for JIRA]. It currently provides polling for new issues and
+new comments.  It is also able to create new issues, add comments, change issues, add/remove watchers, add attachment
+and transition the state of an issue.
+
+Rather than webhooks, this endpoint relies on simple polling. Reasons
+include:
+
+* Concern for reliability/stability
+* The types of payloads we're polling aren't typically large (plus, paging is available in the API)
+* The need to support apps running somewhere not publicly accessible where a webhook would fail
+
+Note that the JIRA API is fairly expansive.  Therefore, this component could be easily expanded to provide additional
+interactions.
+
+Maven users will need to add the following dependency to their pom.xml
+for this component:
+
+[source,xml]
+---------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-jira</artifactId>
+    <version>${camel-version}</version>
+</dependency>
+---------------------------------------
+
+### URI format
+
+[source,text]
+-------------------------
+jira://type[?options]
+-------------------------
+
+### JIRA Options
+
+
+// component options: START
+The Jira component supports 2 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *configuration* (advanced) | The JiraConfiguration parameters |  | JiraConfiguration
+| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean
+|===
+// component options: END
+
+The Jira type accepts the following operations:
+
+For consumers:
+
+* newIssues: retrieve only new issues after the route is started
+* newComments: retrieve only new comments after the route is started
+
+For producers:
+
+* addIssue: add an issue
+* addComment: add a comment on a given issue
+* attach: add an attachment on a given issue
+* deleteIssue: delete a given issue
+* updateIssue: update fields of a given issue
+* transitionIssue: transition a status of a given issue
+* watchers: add/remove watchers of a given issue
+
+As Jira is fully customizable, you must assure the fields IDs exists for the project and workflow, as they can change between different Jira servers.
+
+// endpoint options: START
+The Jira endpoint is configured using URI syntax:
+
+----
+jira:type
+----
+
+with the following path and query parameters:
+
+==== Path Parameters (1 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *type* | *Required* Operation to perform. Consumers: NewIssues, NewComments. Producers: AddIssue, AttachFile, DeleteIssue, TransitionIssue, UpdateIssue, Watchers. See this class javadoc description for more information. |  | JiraType
+|===
+
+
+==== Query Parameters (14 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *delay* (common) | Time in milliseconds to elapse for the next poll. | 6000 | Integer
+| *jiraUrl* (common) | *Required* The Jira server url, example: http://my_jira.com:8081 |  | String
+| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
+| *jql* (consumer) | JQL is the query language from JIRA which allows you to retrieve the data you want. For example jql=project=MyProject Where MyProject is the product key in Jira. It is important to use the RAW() and set the JQL inside it to prevent camel parsing it, example: RAW(project in (MYP, COM) AND resolution = Unresolved) |  | String
+| *maxResults* (consumer) | Max number of issues to search for | 50 | Integer
+| *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
+| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
+| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
+| *accessToken* (security) | (OAuth only) The access token generated by the Jira server. |  | String
+| *consumerKey* (security) | (OAuth only) The consumer key from Jira settings. |  | String
+| *password* (security) | (Basic authentication only) The password to authenticate to the Jira server. Use only if username basic authentication is used. |  | String
+| *privateKey* (security) | (OAuth only) The private key generated by the client to encrypt the conversation to the server. |  | String
+| *username* (security) | (Basic authentication only) The username to authenticate to the Jira server. Use only if OAuth is not enabled on the Jira server. Do not set the username and OAuth token parameter, if they are both set, the username basic authentication takes precedence. |  | String
+| *verificationCode* (security) | (OAuth only) The verification code from Jira generated in the first step of the authorization proccess. |  | String
+|===
+// endpoint options: END
+
+// spring-boot-auto-configure options: START
+=== Spring Boot Auto-Configuration
+
+When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-jira-starter</artifactId>
+  <version>x.x.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+
+The component supports 10 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.component.jira.configuration.access-token* | (OAuth only) The access token generated by the Jira server. |  | String
+| *camel.component.jira.configuration.consumer-key* | (OAuth only) The consumer key from Jira settings. |  | String
+| *camel.component.jira.configuration.delay* | Time in milliseconds to elapse for the next poll. | 6000 | Integer
+| *camel.component.jira.configuration.jira-url* | The Jira server url, example: http://my_jira.com:8081 |  | String
+| *camel.component.jira.configuration.password* | (Basic authentication only) The password to authenticate to the Jira server. Use only if username basic authentication is used. |  | String
+| *camel.component.jira.configuration.private-key* | (OAuth only) The private key generated by the client to encrypt the conversation to the server. |  | String
+| *camel.component.jira.configuration.username* | (Basic authentication only) The username to authenticate to the Jira server. Use only if OAuth is not enabled on the Jira server. Do not set the username and OAuth token parameter, if they are both set, the username basic authentication takes precedence. |  | String
+| *camel.component.jira.configuration.verification-code* | (OAuth only) The verification code from Jira generated in the first step of the authorization proccess. |  | String
+| *camel.component.jira.enabled* | Whether to enable auto configuration of the jira component. This is enabled by default. |  | Boolean
+| *camel.component.jira.resolve-property-placeholders* | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | Boolean
+|===
+// spring-boot-auto-configure options: END
+
+
+### Client Factory
+
+You can bind the `JiraRestClientFactory` with name *JiraRestClientFactory* in the registry to have it automatically set in the Jira endpoint.
+
+### Authentication
+
+Camel-jira supports *https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/[Basic Authentication]* and *https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/[OAuth 3 legged authentication]*.
+
+We recommend to use OAuth whenever possible, as it provides the best security for your users and system.
+
+#### Basic authentication requirements:
+
+* An username and password
+
+#### OAuth authentication requirements:
+
+Follow the tutorial in https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/[Jira OAuth documentation]
+to generate the client private key, consumer key, verification code and access token.
+
+* a private key, generated locally on your system.
+* A verification code, generated by Jira server.
+* The consumer key, set in the Jira server settings.
+* An access token, generated by Jira server.
+
+### JQL:
+
+The JQL URI option is used by both consumer endpoints.  Theoretically,
+items like "project key", etc. could be URI options themselves.
+ However, by requiring the use of JQL, the consumers become much more
+flexible and powerful.
+
+At the bare minimum, the consumers will require the following:
+
+[source,text]
+--------------------------------------------------------------
+jira://[type]?[required options]&jql=project=[project key]
+--------------------------------------------------------------
+
+One important thing to note is that the newIssues consumer will
+automatically set the JQL as:
+
+* append `ORDER BY key desc` to your JQL
+* prepend `id > latestIssueId` to retrieve issues added after the camel route was started.
+
+This is in order to optimize startup processing, rather than having to index every single
+issue in the project.
+
+Another note is that, similarly, the newComments consumer will have to
+index every single issue *and* comment in the project. Therefore, for
+large projects, it's *vital* to optimize the JQL expression as much as
+possible. For example, the JIRA Toolkit Plugin includes a "Number of
+comments" custom field -- use '"Number of comments" > 0' in your query.
+Also try to minimize based on state (status=Open), increase the polling
+delay, etc. Example:
+
+[source,text]
+----------------------------------------------------------------------------------------------------------------------------------------------
+jira://[type]?[required options]&jql=RAW(project=[project key] AND status in (Open, \"Coding In Progress\") AND \"Number of comments\">0)"
+----------------------------------------------------------------------------------------------------------------------------------------------
+
+## Operations
+
+See a list of required headers to set when using the Jira operations. The author field for the producers is automatically set to the authenticated user in the Jira side.
+
+If any required field is not set, then an IllegalArgumentException is throw.
+
+There are operations that requires `id` for fields suchs as: issue type, priority, transition. Check the valid `id` on your jira project as they may differ on a jira installation and project workflow.
+
+### AddIssue
+
+Required:
+
+* `ProjectKey`: The project key, example: CAMEL, HHH, MYP.
+* `IssueTypeId` or `IssueTypeName`: The `id` of the issue type or the name of the issue type, you can see the valid list in `http://jira_server/rest/api/2/issue/createmeta?projectKeys=SAMPLE_KEY`.
+* `IssueSummary`: The summary of the issue.
+
+Optional:
+
+* `IssueAssignee`: the assignee user
+* `IssuePriorityId` or `IssuePriorityName`: The priority of the issue, you can see the valid list in `http://jira_server/rest/api/2/priority`.
+* `IssueComponents`: A list of string with the valid component names.
+* `IssueWatchersAdd`: A list of strings with the usernames to add to the watcher list.
+* `IssueDescription`: The description of the issue.
+
+### AddComment
+
+Required:
+
+* `IssueKey`: The issue key identifier.
+* body of the exchange is the description.
+
+### AttachFile
+
+Only one file should attach per invocation.
+
+Required:
+
+* `IssueKey`: The issue key identifier.
+* body of the exchange should be of type `GenericFile`
+
+### DeleteIssue
+
+Required:
+
+* `IssueKey`: The issue key identifier.
+
+### TransitionIssue
+
+Required:
+
+* `IssueKey`: The issue key identifier.
+* `IssueTransitionId`: The issue transition `id`.
+* body of the exchange is the description.
+
+### UpdateIssue
+
+* `IssueKey`: The issue key identifier.
+* `IssueTypeId` or `IssueTypeName`: The `id` of the issue type or the name of the issue type, you can see the valid list in `http://jira_server/rest/api/2/issue/createmeta?projectKeys=SAMPLE_KEY`.
+* `IssueSummary`: The summary of the issue.
+* `IssueAssignee`: the assignee user
+* `IssuePriorityId` or `IssuePriorityName`: The priority of the issue, you can see the valid list in `http://jira_server/rest/api/2/priority`.
+* `IssueComponents`: A list of string with the valid component names.
+* `IssueDescription`: The description of the issue.
+
+### Watcher
+
+* `IssueKey`: The issue key identifier.
+* `IssueWatchersAdd`: A list of strings with the usernames to add to the watcher list.
+* `IssueWatchersRemove`: A list of strings with the usernames to remove from the watcher list.
+