abstract class EdgeJob in Apigee Edge 8
Base class for all Apigee Edge communication jobs.
Hierarchy
Expanded class hierarchy of EdgeJob
File
- src/
Job/ EdgeJob.php, line 27
Namespace
Drupal\apigee_edge\JobView source
abstract class EdgeJob extends Job {
/**
* Request data.
*
* @var array
*/
protected $request;
/**
* Response data.
*
* @var array
*/
protected $response;
/**
* {@inheritdoc}
*/
public function execute() : bool {
$this
->executeRequest();
$journal = $this
->getConnector()
->getClient()
->getJournal();
$request = $journal
->getLastRequest();
$response = $journal
->getLastResponse();
if (!isset($request) || !isset($response)) {
return FALSE;
}
$this->request = [
'method' => $request
->getMethod(),
'path' => $request
->getUri(),
'headers' => $request
->getHeaders(),
'body' => $request
->getBody()
->getContents(),
];
$this->response = [
'version' => $response
->getProtocolVersion(),
'status' => $response
->getStatusCode(),
'headers' => $response
->getHeaders(),
'body' => $response
->getBody()
->getContents(),
];
return FALSE;
}
/**
* Returns the SDK connector instance from the global container.
*
* The reason why this is not injected, because this class will be serialized,
* and the service class contains elements that can't be serialized.
*
* @return \Drupal\apigee_edge\SDKConnector
* The SDK connector service.
*/
protected function getConnector() : SDKConnectorInterface {
return \Drupal::service('apigee_edge.sdk_connector');
}
/**
* Executes the request itself.
*/
protected abstract function executeRequest();
/**
* {@inheritdoc}
*/
public function renderArray() : array {
// TODO visualize Journal.
return [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EdgeJob:: |
protected | property | Request data. | |
EdgeJob:: |
protected | property | Response data. | |
EdgeJob:: |
public | function |
Executes this job. Overrides Job:: |
1 |
EdgeJob:: |
abstract protected | function | Executes the request itself. | 3 |
EdgeJob:: |
protected | function | Returns the SDK connector instance from the global container. | |
EdgeJob:: |
public | function |
Returns this job's visual representation. Overrides Job:: |
|
Job:: |
protected | property | Exception storage. | |
Job:: |
private | property | Job ID. | |
Job:: |
protected | property | Messages storage. | |
Job:: |
protected | property | Remaining retries. | |
Job:: |
protected | property | Job status. | |
Job:: |
private | property | The tag of the job. | |
Job:: |
protected | constant | Job statuses. | |
Job:: |
public | function | Consumes a retry. | |
Job:: |
public | constant | Job is failed, and it won't be retried. | |
Job:: |
public | constant | Job is finished successfully. | |
Job:: |
public | function | Gets all stored exception data. | |
Job:: |
public | function | Gets the job id. | |
Job:: |
public | function | Gets all stored messages. | |
Job:: |
public | function | Gets the status of the job. | |
Job:: |
public | function | Gets the job tag. | |
Job:: |
public | constant | Job is waiting to be picked up by a worker. | |
Job:: |
public | function | Adds an exception to the exception storage. | |
Job:: |
public | function | Adds a message to the message storage. | |
Job:: |
public | constant | Job failed, waiting to be retried. | |
Job:: |
public | constant | Job is running. | |
Job:: |
public | constant | Job is claimed by a worker, but not running yet. | |
Job:: |
public | function | Sets the status of the job. | |
Job:: |
public | function | Sets the job tag. | |
Job:: |
public | function | Whether this job should be retried when an exception is thrown. | |
Job:: |
public | function | Job constructor. | 3 |
Job:: |
abstract public | function | Returns this job's textual representation. | 5 |