Class GitHubEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
org.apache.camel.component.github.GitHubEndpoint
- 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.HasCamelContext
,org.apache.camel.spi.HasId
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.15.0",
scheme="github",
title="GitHub",
syntax="github:type/branchName",
category={FILE,CLOUD,API},
headersClass=GitHubConstants.class)
public class GitHubEndpoint
extends org.apache.camel.support.ScheduledPollEndpoint
Interact with the GitHub API.
The endpoint encapsulates portions of the GitHub API, relying on the org.eclipse.egit.github.core Java SDK. Available
endpoint URIs include:
CONSUMERS github://pullRequest (new pull requests) github://pullRequestComment (new pull request comments)
github://commit/[branch] (new commits) github://tag (new tags)
PRODUCERS github://pullRequestComment (create a new pull request comment; see PullRequestCommentProducer for header
requirements)
The endpoints will respond with org.eclipse.egit.github.core-provided POJOs (PullRequest, CommitComment,
RepositoryTag, RepositoryCommit, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
protected void
doInit()
getState()
getType()
void
setBranchName
(String branchName) Name of branchvoid
setEncoding
(String encoding) To use the given encoding when getting a git commit filevoid
setEventFetchStrategy
(GitHubEventFetchStrategy eventFetchStrategy) To specify a custom strategy that configures how the EventsConsumer fetches events.void
setOauthToken
(String oauthToken) GitHub OAuth token.void
setRepoName
(String repoName) GitHub repository namevoid
setRepoOwner
(String repoOwner) GitHub repository owner (organization)void
setStartingSha
(String startingSha) The starting sha to use for polling commits with the commit consumer.void
To set git commit status statevoid
setTargetUrl
(String targetUrl) To set git commit status target urlvoid
setType
(GitHubType type) What git operation to executeMethods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, 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, 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, doStart, doStop, doSuspend, fail, 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, 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
-
GitHubEndpoint
-
-
Method Details
-
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
getType
-
setType
What git operation to execute -
getBranchName
-
setBranchName
Name of branch -
getStartingSha
-
setStartingSha
The starting sha to use for polling commits with the commit consumer. The value can either be a sha for the sha to start from, or use beginning to start from the beginning, or last to start from the last commit. -
getOauthToken
-
setOauthToken
GitHub OAuth token. Must be configured on either component or endpoint. -
getRepoOwner
-
setRepoOwner
GitHub repository owner (organization) -
getRepoName
-
setRepoName
GitHub repository name -
getState
-
setState
To set git commit status state -
getTargetUrl
-
setTargetUrl
To set git commit status target url -
getEncoding
-
setEncoding
To use the given encoding when getting a git commit file -
getEventFetchStrategy
-
setEventFetchStrategy
To specify a custom strategy that configures how the EventsConsumer fetches events. -
doInit
- Overrides:
doInit
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-