A base class for classes representing a long running job on a server. More...
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Functions
virtual | ~Job() override |
Esri::ArcGISRuntime::TaskWatcher | cancelAsync() |
Esri::ArcGISRuntime::TaskWatcher | checkStatus() |
Esri::ArcGISRuntime::Error | error() const |
Esri::ArcGISRuntime::JobStatus | jobStatus() const |
Esri::ArcGISRuntime::JobType | jobType() const |
QList<Esri::ArcGISRuntime::JobMessage> | messages() const |
bool | pause() |
int | progress() const |
QString | serverJobId() const |
bool | start() |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::Credential * | credential() const override |
virtual Esri::ArcGISRuntime::RequestConfiguration | requestConfiguration() const override |
virtual void | setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override |
virtual QString | toJson() const override |
virtual QJsonObject | unknownJson() const override |
virtual QJsonObject | unsupportedJson() const override |
Signals
void | cancelAsyncCompleted(QUuid taskId, bool succeeded) |
void | checkStatusCompleted(QUuid taskId, bool succeeded) |
void | jobDone() |
void | messageAdded(const Esri::ArcGISRuntime::JobMessage &message) |
void | progressChanged() |
void | statusChanged(Esri::ArcGISRuntime::JobStatus status) |
Static Public Members
Esri::ArcGISRuntime::Job * | fromJson(const QString &json, QObject *parent = nullptr) |
Reimplemented Protected Functions
virtual QUrl | url() const override |
Detailed Description
A job is a long running operation that is completed by an ArcGIS Server asynchronous service operation. They are submitted to an ArcGIS Server end point, they have regular status updates as the job is completed and a result is then returned. Different types of jobs exist and each can have different stages.
A job is initiated when it is submitted to the server. When the server accepts the job, it assigns a unique ID to the job. This ID is available in the serverJobId property.
Job instances created by tasks and returned by task methods are returned in a JobStatus::NotStarted state. For these, call start to start the associated operation.
After the job is initiated on the server and started, the client listens for the jobDone signal to know when the job is done. While the job is not yet done, the client may listen for the jobStatusChanged signal and examine the jobStatus or progress methods to monitor progress.
Classes that inherit from this class may implement a property containing the job's results, whose type depends on the type of job.
If the job fails, information about the failure is available in the error property.
See also JobStatus.
Member Function Documentation
[signal]
void Job::cancelAsyncCompleted (QUuid taskId , bool succeeded)
Signal emitted when the cancelAsync operation completes.
- taskId - The task ID of the asynchronous operation.
- succeeded - Whether the cancel operation was successful.
This function was introduced in Esri::ArcGISRuntime 100.14.
[signal]
void Job::checkStatusCompleted (QUuid taskId , bool succeeded)
Signal emitted when checking the status has completed.
The result can be false if the job is not checking server status for example if the job status is paused or uploading.
- taskId - The task ID of the asynchronous task.
- succeeded - Whether the current status of the job was checked from the service.
This function was introduced in Esri::ArcGISRuntime 100.1.
See also jobStatus.
[signal]
void Job::jobDone ()
Signal emitted when this Job is done.
[signal]
void Job::messageAdded (const Esri::ArcGISRuntime::JobMessage &message)
Signal emitted when a new JobMessage is added to Job::messages.
- message - The new JobMessage.
This function was introduced in Esri::ArcGISRuntime 100.14.
[signal]
void Job::progressChanged ()
Signal emitted when the progress complete changes.
This function was introduced in Esri::ArcGISRuntime 100.1.
[signal]
void Job::statusChanged (Esri::ArcGISRuntime::JobStatus status)
Signal emitted when the jobStatus property changes.
- status - The new jobStatus
This function was introduced in Esri::ArcGISRuntime 100.14.
[override virtual]
Job::~Job()
Destructor.
Esri::ArcGISRuntime::TaskWatcher Job::cancelAsync ()
Cancels this Job and waits for any asynchronous, server-side operations to be canceled.
The job is canceled and will result in a JobStatus::Failed status after all cancellation tasks have completed. For jobs running on a server, a cancel request is sent for the associated serverJobId. You should always cancel unneeded jobs (for example when exiting your app) to avoid placing unnecessary load on the server. Examples of server-side jobs include:
In addition, the GenerateOfflineMapJob is composed of several server-side jobs, depending on the types of layers in your Map. Canceling this high-level job will also send a cancel request to the underlying server jobs.
Upon calling this method, the jobStatus is immediately set to JobStatus::Canceling.
This method returns a TaskWatcher for the asynchronous operation.
This function was introduced in Esri::ArcGISRuntime 100.14.
Esri::ArcGISRuntime::TaskWatcher Job::checkStatus ()
Checks the current job status from the service and returns a TaskWatcher for the asynchronous task.
The task completes after the status has been checked. If the job is polling the server for status and is in a time gap, then calling this method will ensure a request is sent right away.
This function was introduced in Esri::ArcGISRuntime 100.1.
See also checkStatusCompleted.
[override virtual]
Esri::ArcGISRuntime::Credential *Job::credential() const
Reimplements: RemoteResource::credential() const.
Returns the security credential used to access the tiled ArcGIS map Service.
This is only applicable if using a service that is secured.
Esri::ArcGISRuntime::Error Job::error() const
Gets the error encountered during execution, if any.
Returns the Error. The error is available when the job status is JobStatus::Failed.
[static]
Esri::ArcGISRuntime::Job *Job::fromJson (const QString &json, QObject *parent = nullptr)
Creates and returns a new Job object from the provided json, with an optional parent.
The Job will be in a paused state.
See also JsonSerializable.
Esri::ArcGISRuntime::JobStatus Job::jobStatus () const
Gets the current status of this Job.
Esri::ArcGISRuntime::JobType Job::jobType () const
Returns the type of this Job.
QList<Esri::ArcGISRuntime::JobMessage > Job::messages() const
Gets the informational messages produced during execution of this job.
Returns the list of JobMessage objects.
bool Job::pause()
Pause this Job.
Returns true
if the job was successfully paused; false
if it is already done, or if there is an error.
int Job::progress() const
Gets the current progress of the job as the percentage complete.
This function was introduced in Esri::ArcGISRuntime 100.1.
[override virtual]
Esri::ArcGISRuntime::RequestConfiguration Job::requestConfiguration () const
Reimplements: RemoteResource::requestConfiguration() const.
Returns the RequestConfiguration in use by this job.
This function was introduced in Esri::ArcGISRuntime 100.1.
See also setRequestConfiguration().
QString Job::serverJobId () const
Gets the unique job ID of this Job on the server on which it is executing.
[override virtual]
void Job::setRequestConfiguration (const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration )
Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).
Sets configuration parameters used for network requests sent by this job to requestConfiguration.
This function was introduced in Esri::ArcGISRuntime 100.1.
See also requestConfiguration().
bool Job::start()
Starts or resumes this Job.
Call this method to start the job initially and also to resume it after it is paused.
Returns true
if the job was successfully started/resumed; false
if it is already done, or if there is an error.
[override virtual]
QString Job::toJson () const
Reimplements: JsonSerializable::toJson() const.
Returns this job as a JSON representation.
See also JsonSerializable.
[override virtual]
QJsonObject Job::unknownJson () const
Reimplements: JsonSerializable::unknownJson() const.
Gets the unknown JSON of this object.
See also JsonSerializable.
[override virtual]
QJsonObject Job::unsupportedJson () const
Reimplements: JsonSerializable::unsupportedJson() const.
Gets the unsupported JSON of this object.
See also JsonSerializable.
[override virtual protected]
QUrl Job::url() const
Reimplements: RemoteResource::url() const.
Returns the URL to a tiled ArcGIS Map service.