ScheduledJobsClient Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. jobs. ScheduledJobsClient
- com.
public class ScheduledJobsClient
Use the ScheduledJobsClient to schedule and cancel jobs for a group of devices using IoT hub.
Constructor Summary
Constructor | Description |
---|---|
ScheduledJobsClient(String connectionString) |
Constructor to create instance from connection string |
ScheduledJobsClient(String hostName, AzureSasCredential azureSasCredential) |
Create a new ScheduledJobsClient instance. |
ScheduledJobsClient(String hostName, AzureSasCredential azureSasCredential, ScheduledJobsClientOptions clientOptions) |
Create a new ScheduledJobsClient instance. |
ScheduledJobsClient(String connectionString, ScheduledJobsClientOptions clientOptions) |
Constructor to create instance from connection string |
ScheduledJobsClient(String hostName, TokenCredential credential) |
Create a new ScheduledJobsClient instance. |
ScheduledJobsClient(String hostName, TokenCredential credential, ScheduledJobsClientOptions clientOptions) |
Create a new ScheduledJobsClient instance. |
Method Summary
Constructor Details
ScheduledJobsClient
public ScheduledJobsClient(String connectionString)
Constructor to create instance from connection string
Parameters:
ScheduledJobsClient
public ScheduledJobsClient(String hostName, AzureSasCredential azureSasCredential)
Create a new ScheduledJobsClient instance.
Parameters:
ScheduledJobsClient
public ScheduledJobsClient(String hostName, AzureSasCredential azureSasCredential, ScheduledJobsClientOptions clientOptions)
Create a new ScheduledJobsClient instance.
Parameters:
ScheduledJobsClient
public ScheduledJobsClient(String connectionString, ScheduledJobsClientOptions clientOptions)
Constructor to create instance from connection string
Parameters:
ScheduledJobsClient
public ScheduledJobsClient(String hostName, TokenCredential credential)
Create a new ScheduledJobsClient instance.
Parameters:
ScheduledJobsClient
public ScheduledJobsClient(String hostName, TokenCredential credential, ScheduledJobsClientOptions clientOptions)
Create a new ScheduledJobsClient instance.
Parameters:
Method Details
cancel
public ScheduledJob cancel(String jobId)
Cancel a current jod on the IoTHub
Parameters:
Returns:
Throws:
get
public ScheduledJob get(String jobId)
Get the current job on the iotHub.
Parameters:
Returns:
Throws:
query
public JobQueryResponse query(ScheduledJobType jobType, ScheduledJobStatus jobStatus)
Query from your IoT Hub's set of scheduled jobs by job type and job status.
Parameters:
Returns:
Throws:
query
public JobQueryResponse query(ScheduledJobType jobType, ScheduledJobStatus jobStatus, QueryPageOptions options)
Query from your IoT Hub's set of scheduled jobs by job type and job status.
Parameters:
Returns:
Throws:
query
public JobQueryResponse query(String query)
Query from your IoT Hub's set of scheduled jobs.
Parameters:
Returns:
Throws:
query
public JobQueryResponse query(String query, QueryPageOptions options)
Query from your IoT Hub's set of scheduled jobs.
Parameters:
Returns:
Throws:
scheduleDirectMethod
public ScheduledJob scheduleDirectMethod(String jobId, String queryCondition, String methodName, Date startTimeUtc)
Creates a new ScheduledJob to invoke method on one or multiple devices
Parameters:
Query condition to evaluate which devices to run the job on. It can benull
</code> or empty </p>
methodName
- Method name to be invoked
startTimeUtc
- Date time in Utc to start the job
Returns:
a jobResult object
Throws:
IOException
- if the function cannot create a URL for the job, or the IO failed on request
IotHubException
- if the http request failed
scheduleDirectMethod
public ScheduledJob scheduleDirectMethod(String jobId, String queryCondition, String methodName, Date startTimeUtc, DirectMethodsJobOptions options)
Creates a new ScheduledJob to invoke method on one or multiple devices
Parameters:
jobId
- Unique ScheduledJob Id for this job
queryCondition
- Query condition to evaluate which devices to run the job on. It can benull
</code> or empty </p>
methodName
- Method name to be invoked
startTimeUtc
- Date time in Utc to start the job
options
- the optional parameters for this request. May not be null.
Returns:
a jobResult object
Throws:
IOException
- if the function cannot create a URL for the job, or the IO failed on request
IotHubException
- if the http request failed
scheduleUpdateTwin
public ScheduledJob scheduleUpdateTwin(String jobId, String queryCondition, Twin updateTwin, Date startTimeUtc, long maxExecutionTimeInSeconds)
Creates a new ScheduledJob to update twin tags and desired properties on one or multiple devices
Parameters:
jobId
- Unique ScheduledJob Id for this job
queryCondition
- Query condition to evaluate which devices to run the job on. It can benull
</code> or empty </p>
updateTwin
- Twin object to use for the update
startTimeUtc
- Date time in Utc to start the job
maxExecutionTimeInSeconds
- Max execution time in seconds, i.e., ttl duration the job can run
Returns:
a jobResult object
Throws:
IOException
- if the function cannot create a URL for the job
IotHubException
- if the http request failed
Applies to
Azure SDK for Java