Class JiraEndpoint
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,org.apache.camel.ComponentAware
,org.apache.camel.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.EndpointServiceLocation
,org.apache.camel.spi.HasCamelContext
,org.apache.camel.spi.HasId
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
The endpoint encapsulates portions of the JIRA API, relying on the jira-rest-java-client SDK. Available endpoint URIs include:
CONSUMERS jira://newIssues (retrieve only new issues after the route is started) jira://newComments (retrieve only new comments after the route is started) jira://watchChanges (retrieve only defined changes in issues picked base on provided jql)
PRODUCERS jira://addIssue (add an issue) jira://addComment (add a comment on a given issue) jira://attach (add an attachment on a given issue) jira://deleteIssue (delete a given issue) jira://updateIssue (update fields of a given issue) jira://transitionIssue (transition a status of a given issue) jira://watchers (add/remove watchers of a given issue)
The endpoints will respond with jira-rest-java-client POJOs (Issue, Comment, etc.)
Note: Rather than webhooks, this endpoint relies on simple polling. Reasons include: - concerned about reliability/stability if this somehow relied on an exposed, embedded server (Jetty?) - the types of payloads we're polling aren't typically large (plus, paging is available in the API) - need to support apps running somewhere not publicly accessible where a webhook would fail
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
ConstructorsConstructorDescriptionJiraEndpoint
(String uri, JiraComponent component, JiraConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoid
connect()
org.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
void
void
doStart()
protected void
doStop()
com.atlassian.jira.rest.client.api.JiraRestClient
long
getDelay()
getJql()
JQL is the query language from JIRA which allows you to retrieve the data you want.getType()
Comma separated list of fields to watch for changes.boolean
Indicator for sending only changed fields in exchange body or issue object.void
setClient
(com.atlassian.jira.rest.client.api.JiraRestClient client) void
void
setMaxResults
(Integer maxResults) Max number of issues to search forvoid
setSendOnlyUpdatedField
(boolean sendOnlyUpdatedField) void
Operation to perform.void
setWatchedFields
(String watchChange) Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.camel.ComponentAware
getComponent
Methods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isRemote, isSingletonProducer
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
JiraEndpoint
-
-
Method Details
-
getServiceUrl
- Specified by:
getServiceUrl
in interfaceorg.apache.camel.spi.EndpointServiceLocation
-
getServiceProtocol
- Specified by:
getServiceProtocol
in interfaceorg.apache.camel.spi.EndpointServiceLocation
-
getServiceMetadata
- Specified by:
getServiceMetadata
in interfaceorg.apache.camel.spi.EndpointServiceLocation
-
getConfiguration
-
doStart
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
connect
public void connect() -
disconnect
- Throws:
Exception
-
createProducer
public org.apache.camel.Producer createProducer()- Specified by:
createProducer
in interfaceorg.apache.camel.Endpoint
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Throws:
Exception
-
getType
-
setType
Operation to perform. Consumers: NewIssues, NewComments. Producers: AddIssue, AttachFile, DeleteIssue, TransitionIssue, UpdateIssue, Watchers. See this class javadoc description for more information. -
getJql
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) -
setJql
-
getDelay
public long getDelay()- Overrides:
getDelay
in classorg.apache.camel.support.ScheduledPollEndpoint
-
getClient
public com.atlassian.jira.rest.client.api.JiraRestClient getClient() -
setClient
public void setClient(com.atlassian.jira.rest.client.api.JiraRestClient client) -
getMaxResults
-
setMaxResults
Max number of issues to search for -
getWatchedFields
Comma separated list of fields to watch for changes. "Status,Priority" are the defaults. -
setWatchedFields
-
isSendOnlyUpdatedField
public boolean isSendOnlyUpdatedField()Indicator for sending only changed fields in exchange body or issue object. By default consumer sends only changed fields. -
setSendOnlyUpdatedField
public void setSendOnlyUpdatedField(boolean sendOnlyUpdatedField)
-