Job Class

  • Job
  • class Esri::ArcGISRuntime::Job

    A base class for classes representing a long running job on a server. More...

    Public Functions

    virtual ~Job() override
    QFuture<bool> cancelJobAsync()
    QFuture<bool> checkStatusAsync()
    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 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 statusChanged 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

    [override virtual] Job::~Job()

    Destructor.

    [since Esri::ArcGISRuntime 200.2] QFuture<bool> Job::cancelJobAsync()

    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 QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [since Esri::ArcGISRuntime 200.2] QFuture<bool> Job::checkStatusAsync()

    Initiates a request to check the server status.

    The task contains a bool indicating if the check was successful. 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. The result can be false if the job is not checking server status for example if the job status is paused or uploading.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [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.

    [signal] void Job::jobDone()

    Signal emitted when this Job is done.

    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.

    [signal, since Esri::ArcGISRuntime 100.14] void Job::messageAdded(const Esri::ArcGISRuntime::JobMessage &message)

    Signal emitted when a new JobMessage is added to Job::messages.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    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.

    [since Esri::ArcGISRuntime 100.1] int Job::progress() const

    Gets the current progress of the job as the percentage complete.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal, since Esri::ArcGISRuntime 100.1] void Job::progressChanged()

    Signal emitted when the progress complete changes.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [override virtual, since Esri::ArcGISRuntime 100.1] 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, since Esri::ArcGISRuntime 100.1] 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.

    [signal, since Esri::ArcGISRuntime 100.14] void Job::statusChanged(Esri::ArcGISRuntime::JobStatus status)

    Signal emitted when the jobStatus property changes.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    [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.

    Returns the unknown data from the source JSON.

    Unknown JSON is a dictionary of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.

    See also JsonSerializable.

    [override virtual] QJsonObject Job::unsupportedJson() const

    Reimplements: JsonSerializable::unsupportedJson() const.

    Returns the unsupported data from the source JSON.

    Unsupported JSON is a dictionary of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.

    See also JsonSerializable.

    [override virtual protected] QUrl Job::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL to a tiled ArcGIS Map service.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.