QueryClient Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.query.QueryClient

public class QueryClient

Constructor Summary

Constructor Description
QueryClient(String connectionString)

Constructor to create instance from connection string

QueryClient(String hostName, AzureSasCredential azureSasCredential)

Create a new QueryClient instance.

QueryClient(String hostName, AzureSasCredential azureSasCredential, QueryClientOptions options)

Create a new QueryClient instance.

QueryClient(String connectionString, QueryClientOptions options)

Constructor to create instance from connection string

QueryClient(String hostName, TokenCredential credential)

Create a new QueryClient instance.

QueryClient(String hostName, TokenCredential credential, QueryClientOptions options)

Create a new QueryClient instance.

Method Summary

Modifier and Type Method and Description
JobQueryResponse queryJobs(ScheduledJobType jobType, ScheduledJobStatus jobStatus)

Query from your IoT Hub's set of scheduled jobs by job type and job status.

JobQueryResponse queryJobs(ScheduledJobType jobType, ScheduledJobStatus jobStatus, QueryPageOptions options)

Query from your IoT Hub's set of scheduled jobs by job type and job status.

JobQueryResponse queryJobs(String query)

Query from your IoT Hub's set of scheduled jobs.

JobQueryResponse queryJobs(String query, QueryPageOptions options)

Query from your IoT Hub's set of scheduled jobs.

RawQueryResponse queryRaw(String query)

Query miscellaneous data from your IoT Hub.

RawQueryResponse queryRaw(String query, QueryPageOptions options)

Query miscellaneous data from your IoT Hub.

TwinQueryResponse queryTwins(String query)

Query from your IoT Hub's set of Twins.

TwinQueryResponse queryTwins(String query, QueryPageOptions options)

Query from your IoT Hub's set of Twins.

Constructor Details

QueryClient

public QueryClient(String connectionString)

Constructor to create instance from connection string

Parameters:

connectionString - The IoT Hub connection string

QueryClient

public QueryClient(String hostName, AzureSasCredential azureSasCredential)

Create a new QueryClient instance.

Parameters:

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.

QueryClient

public QueryClient(String hostName, AzureSasCredential azureSasCredential, QueryClientOptions options)

Create a new QueryClient instance.

Parameters:

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.

QueryClient

public QueryClient(String connectionString, QueryClientOptions options)

Constructor to create instance from connection string

Parameters:

connectionString - The IoT Hub connection string
options - The connection options to use when connecting to the service.

QueryClient

public QueryClient(String hostName, TokenCredential credential)

Create a new QueryClient instance.

Parameters:

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.

QueryClient

public QueryClient(String hostName, TokenCredential credential, QueryClientOptions options)

Create a new QueryClient instance.

Parameters:

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.

Method Details

queryJobs

public JobQueryResponse queryJobs(ScheduledJobType jobType, ScheduledJobStatus jobStatus)

Query from your IoT Hub's set of scheduled jobs by job type and job status.

Parameters:

jobType - The type of the job (methods or twin).
jobStatus - The status of the job ("completed", for example)

Returns:

The pageable set of Jobs that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as throttling.

queryJobs

public JobQueryResponse queryJobs(ScheduledJobType jobType, ScheduledJobStatus jobStatus, QueryPageOptions options)

Query from your IoT Hub's set of scheduled jobs by job type and job status.

Parameters:

jobType - The type of the job (methods or twin).
jobStatus - The status of the job ("completed", for example)
options - The optional parameters used to decide how the query's results are returned. May not be null.

Returns:

The pageable set of Jobs that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as throttling.

queryJobs

public JobQueryResponse queryJobs(String query)

Query from your IoT Hub's set of scheduled jobs.

Parameters:

query - The IoT Hub query for selecting which jobs to getJob.

Returns:

The pageable set of Jobs that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.

queryJobs

public JobQueryResponse queryJobs(String query, QueryPageOptions options)

Query from your IoT Hub's set of scheduled jobs.

Parameters:

query - The IoT Hub query for selecting which jobs to getJob.
options - The optional parameters used to decide how the query's results are returned. May not be null.

Returns:

The pageable set of Jobs that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.

queryRaw

public RawQueryResponse queryRaw(String query)

Query miscellaneous data from your IoT Hub.

Parameters:

query - The IoT Hub query for selecting what information should be returned.

Returns:

The pageable set of results that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.

queryRaw

public RawQueryResponse queryRaw(String query, QueryPageOptions options)

Query miscellaneous data from your IoT Hub.

Parameters:

query - The IoT Hub query for selecting what information should be returned.
options - The optional parameters used to decide how the query's results are returned. May not be null.

Returns:

The pageable set of results that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.

queryTwins

public TwinQueryResponse queryTwins(String query)

Query from your IoT Hub's set of Twins.

Parameters:

query - The IoT Hub query for selecting which twins to getJob.

Returns:

The pageable set of Twins that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.

queryTwins

public TwinQueryResponse queryTwins(String query, QueryPageOptions options)

Query from your IoT Hub's set of Twins.

Parameters:

query - The IoT Hub query for selecting which twins to getJob.
options - The optional parameters used to decide how the query's results are returned.

Returns:

The pageable set of Twins that were queried.

Throws:

IOException - If IoT Hub cannot be reached due to network level issues.
IotHubException - If the request fails for non-network level issues such as an incorrectly formatted query.

Applies to