Page MenuHomePhabricator

abstract class DoorkeeperFeedWorker
Phabricator Technical Documentation (Doorkeeper)

Publish events (like comments on a revision) to external objects which are linked through Doorkeeper (like a linked JIRA or Asana task).

These workers are invoked by feed infrastructure during normal task queue operations. They read feed stories and publish information about them to external systems, generally mirroring comments and updates in Phabricator into remote systems by making API calls.

Methods

abstract protected function publishFeedStory()

Actually publish the feed story. Subclasses will generally make API calls to publish some version of the story into external systems.

Return
void

abstract public function isEnabled()

Enable or disable the worker. Normally, this checks configuration to see if Phabricator is linked to applicable external systems.

Return
boolTrue if this worker should try to publish stories.

protected function getFeedStory()

Get the PhabricatorFeedStory that should be published.

Return
PhabricatorFeedStoryThe story to publish.

protected function getViewer()

Get the viewer for the act of publishing.

NOTE: Publishing currently uses the omnipotent viewer because it depends on loading external accounts. Possibly we should tailor this. See T3732. Using the actor for most operations might make more sense.
Return
PhabricatorUserViewer.

protected function getPublisher()

Get the DoorkeeperFeedStoryPublisher which handles this object.

Return
DoorkeeperFeedStoryPublisherObject publisher.

protected function getStoryObject()

Get the primary object the story is about, like a DifferentialRevision or ManiphestTask.

Return
objectObject which the story is about.

private function loadPublisher()

Load the DoorkeeperFeedStoryPublisher which corresponds to this object. Publishers provide a common API for pushing object updates into foreign systems.

Return
DoorkeeperFeedStoryPublisherPublisher for the story's object.

final protected function doWork()

Doorkeeper workers set up some context, then call publishFeedStory().

Return
wild

public function getMaximumRetryCount()

By default, Doorkeeper workers perform a small number of retries with exponential backoff. A consideration in this policy is that many of these workers are laden with side effects.

Return
wild

public function getWaitBeforeRetry($task)

See getMaximumRetryCount() for a description of Doorkeeper retry defaults.

Parameters
PhabricatorWorkerTask$task
Return
wild