public class JobClient extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
JobClient() |
| Modifier and Type | Method and Description |
|---|---|
JobResult |
cancelJob(String jobId)
Cancel a current jod on the IoTHub
|
static JobClient |
createFromConnectionString(String connectionString)
Static constructor to create instance from connection string
|
JobResult |
getJob(String jobId)
Get the current job on the iotHub.
|
JobResult |
getNextJob(Query query)
returns the next job result in response.
|
boolean |
hasNextJob(Query query)
returns the availability of next job result in response.
|
Query |
queryDeviceJob(String sqlQuery)
Query for device Job limited by default page size of 100 for response
|
Query |
queryDeviceJob(String sqlQuery,
Integer pageSize)
Query for device Job
|
Query |
queryJobResponse(JobType jobType,
JobStatus jobStatus)
Query the iot hub for a jobs response.
|
Query |
queryJobResponse(JobType jobType,
JobStatus jobStatus,
Integer pageSize)
Query the iot hub for a jobs response.
|
JobResult |
scheduleDeviceMethod(String jobId,
String queryCondition,
String methodName,
Long responseTimeoutInSeconds,
Long connectTimeoutInSeconds,
Object payload,
Date startTimeUtc,
long maxExecutionTimeInSeconds)
Creates a new Job to invoke method on one or multiple devices
|
JobResult |
scheduleUpdateTwin(String jobId,
String queryCondition,
DeviceTwinDevice updateTwin,
Date startTimeUtc,
long maxExecutionTimeInSeconds)
Creates a new Job to update twin tags and desired properties on one or multiple devices
|
public static JobClient createFromConnectionString(String connectionString) throws IOException, IllegalArgumentException
connectionString - The iot hub connection stringIOException - if the object creation failedIllegalArgumentException - if the provided connectionString is null or emptypublic JobResult scheduleUpdateTwin(String jobId, String queryCondition, DeviceTwinDevice updateTwin, Date startTimeUtc, long maxExecutionTimeInSeconds) throws IllegalArgumentException, IOException, IotHubException
jobId - Unique Job Id for this jobqueryCondition - Query condition to evaluate which devices to run the job on. It can be null or emptyupdateTwin - Twin object to use for the updatestartTimeUtc - Date time in Utc to start the jobmaxExecutionTimeInSeconds - Max execution time in seconds, i.e., ttl duration the job can runIllegalArgumentException - if one of the provided parameters is invalidIOException - if the function cannot create a URL for the jobIotHubException - if the http request failedpublic JobResult scheduleDeviceMethod(String jobId, String queryCondition, String methodName, Long responseTimeoutInSeconds, Long connectTimeoutInSeconds, Object payload, Date startTimeUtc, long maxExecutionTimeInSeconds) throws IllegalArgumentException, IOException, IotHubException
jobId - Unique Job Id for this jobqueryCondition - Query condition to evaluate which devices to run the job on. It can be null or emptymethodName - Method name to be invokedresponseTimeoutInSeconds - Maximum interval of time, in seconds, that the Direct Method will wait for answer. It can be null.connectTimeoutInSeconds - Maximum interval of time, in seconds, that the Direct Method will wait for the connection. It can be null.payload - Object that contains the payload defined by the user. It can be null.startTimeUtc - Date time in Utc to start the jobmaxExecutionTimeInSeconds - Max execution time in seconds, i.e., ttl duration the job can runIllegalArgumentException - if one of the provided parameters is invalidIOException - if the function cannot create a URL for the job, or the IO failed on requestIotHubException - if the http request failedpublic JobResult getJob(String jobId) throws IllegalArgumentException, IOException, IotHubException
jobId - Unique Job Id for this jobIllegalArgumentException - if the jobId is invalidIOException - if the function cannot create a URL for the job, or the IO failed on requestIotHubException - if the http request failedpublic JobResult cancelJob(String jobId) throws IllegalArgumentException, IOException, IotHubException
jobId - Unique Job Id for this jobIllegalArgumentException - if the jobId is invalidIOException - if the function cannot create a URL for the job, or the IO failed on requestIotHubException - if the http request failedpublic Query queryDeviceJob(String sqlQuery, Integer pageSize) throws IotHubException, IOException
sqlQuery - sql style query over device.jobspageSize - the value per which to limit the size of query response by.IotHubException - When IotHub fails to respondIOException - When any of the parameters are incorrectpublic Query queryDeviceJob(String sqlQuery) throws IotHubException, IOException
sqlQuery - sql style query over device.jobsIotHubException - When IotHub fails to respondIOException - When any of the parameters are incorrectpublic boolean hasNextJob(Query query) throws IotHubException, IOException
query - Query for which to look for next job response byIotHubException - When IotHub fails to respondIOException - if any of the input parameters are incorrectpublic JobResult getNextJob(Query query) throws IOException, IotHubException, NoSuchElementException
query - Query for which to look for next job response byIotHubException - When IotHub fails to respondIOException - if any of the input parameters are incorrectNoSuchElementException - if called when no further responses are leftpublic Query queryJobResponse(JobType jobType, JobStatus jobStatus, Integer pageSize) throws IOException, IotHubException
jobType - The type of job to query forjobStatus - The status of the job to query forpageSize - The value to which to limit the job response size byIOException - If any of the input parameters are incorrectIotHubException - If IotHub failed to respondpublic Query queryJobResponse(JobType jobType, JobStatus jobStatus) throws IotHubException, IOException
jobType - The type of job to query forjobStatus - The status of the job to query forIOException - If any of the input parameters are incorrectIotHubException - If IotHub failed to respondCopyright © 2017. All rights reserved.