public class JobClient extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
JobClient() |
|
JobClient(String connectionString)
Constructor to create instance from connection string
|
|
JobClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential)
Create a new JobClient instance.
|
|
JobClient(String hostName,
com.azure.core.credential.AzureSasCredential azureSasCredential,
JobClientOptions options)
Create a new JobClient instance.
|
|
JobClient(String connectionString,
JobClientOptions options)
Constructor to create instance from connection string
|
|
JobClient(String hostName,
com.azure.core.credential.TokenCredential credential)
Create a new JobClient instance.
|
|
JobClient(String hostName,
com.azure.core.credential.TokenCredential credential,
JobClientOptions options)
Create a new JobClient instance.
|
| Modifier and Type | Method and Description |
|---|---|
JobResult |
cancelJob(String jobId)
Cancel a current jod on the IoTHub
|
static JobClient |
createFromConnectionString(String connectionString)
Deprecated.
because this method declares a thrown IOException even though it never throws an IOException. Users
are recommended to use
JobClient(String) instead
since it does not declare this exception even though it constructs the same JobClient. |
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 JobClient(String connectionString)
connectionString - The iot hub connection stringpublic JobClient(String connectionString, JobClientOptions options)
connectionString - The iot hub connection stringoptions - The connection options to use when connecting to the service.public JobClient(String hostName, com.azure.core.credential.TokenCredential credential)
hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")credential - The custom TokenCredential that will provide authentication tokens to
this library when they are needed. The provided tokens must be Json Web Tokens.public JobClient(String hostName, com.azure.core.credential.TokenCredential credential, JobClientOptions options)
hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")credential - The custom TokenCredential that will provide authentication tokens to
this library when they are needed. The provided tokens must be Json Web Tokens.options - The connection options to use when connecting to the service.public JobClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential)
hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")azureSasCredential - The SAS token provider that will be used for authentication.public JobClient(String hostName, com.azure.core.credential.AzureSasCredential azureSasCredential, JobClientOptions options)
hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")azureSasCredential - The SAS token provider that will be used for authentication.options - The connection options to use when connecting to the service.protected JobClient()
@Deprecated public static JobClient createFromConnectionString(String connectionString) throws IOException, IllegalArgumentException
JobClient(String) instead
since it does not declare this exception even though it constructs the same JobClient.connectionString - The iot hub connection stringIOException - This exception is never thrown.IllegalArgumentException - 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 © 2022. All rights reserved.