You can programmatically retrieve the status of a LiveCycle
job by using the Job Manager API. A job occurs when a long-lived process
is invoked. For example, when you invoke a long-lived process by
using the Invocation API, a job is created.
The following list specifies job status values:
-
0 (JOB_STATUS_UNKNOWN)
: Indicates that the job status
is unknown
-
1 (JOB_STATUS_QUEUED)
: Indicates that the job is queued.
-
2 (JOB_STATUS_RUNNING)
: Indicates that the job is currently
running
-
3
(
JOB_STATUS_COMPLETED
): Indicates that the job
is completed
-
4
(
JOB_STATUS_FAILED
): Indicates that the job failed
-
5 (JOB_STATUS_TERMINATED)
: Indicates that the job
is terminated
-
6 (JOB_STATUS_SUSPENDED)
: Indicates that the job is suspended
-
7 (JOB_STATUS_COMPLETE_REQUESTED
): Indicates that a
job complete request was made
-
8 (JOB_STATUS_TERMINATE_REQUESTED
): Indicates that
a job terminate request was made
-
9 (JOB_STATUS_SUSPEND_REQUESTED
): Indicates that a job
suspend request was made
-
10 (JOB_STATUS_RESUME_REQUESTED)
: Indicates that a job
resume request was made
Summary of steps
To retrieve the status of a LiveCycle job, perform
the following tasks:
-
Include project files.
-
Create a JobManager Client API object.
-
Specify search criteria.
-
Perform the search.
-
Iterate through the returned job instances.
Include project files
Include necessary files into your development
project. If you are creating a client application by using Java,
include the necessary JAR files. If you are using web services,
make sure that you include the proxy files.
Create a JobManager Client API object
Before you can programmatically
retrieve LiveCycle job instances, you must create a
JobManager
object.
Specify filter criteria
To search for job status values, define
filter criteria. You can, for example, limit the number of jobs
that are returned. To define filter criteria, you use a
JobInstanceFilter
instance.
Perform the search
After you specify filter criteria, you can
perform the search. All job instances are returned within a list.
That is, each element in the list is a
JobInstance
object.
Iterate through the returned job instances
Iterate through the
returned list to retrieve each process instance. After you obtain
a process instance, you can obtain information about it. For example,
you can determine its status.
Retrieve the status of a job using the Java API
Retrieve the status of a job by using the Job Manager API
(Java):
-
Include project files
Include client JAR files,
such as adobe-jobmanager-client-sdk.jar, in your Java project’s
class path.
-
Create a JobManager Client API object
-
Specify filter criteria
-
Create a
JobInstanceFilter
object
that is used to define search criteria by using its constructor.
-
Define filter criteria by invoking an appropriate method
that belongs to the
JobInstanceFilter
object. For example,
to define the maximum number of jobs to return, invoke the
JobInstanceFilter
object’s
setMaxObjects
method,
and pass an integer value that specifies value.
-
Perform the search
Search for jobs by invoking the
JobManager
object’s
getJobInstances
method
and passing the
JobInstanceFilter
object. This
method returns a
java.util.List
instance, where
each element is a
JobInstance
instance that represents
a LiveCycle job.
-
Iterate through the returned job instances
-
Create a
java.util.Iterator
object by invoking
the
java.util.List
object’s
iterator
method.
This object lets you iterate through the
java.util.List
instance
to retrieve job instances.
-
Iterate through the
java.util.List
object.
If they are jpb instances, each element is a
JobInstance
instance.
-
Retrieve information about a job by invoking an appropriate method
that belongs to the
JobInstance
object. For example,
to get the status of the job, invoke the
JobInstance
object’s
getStatus
method.
|
|
|