DirectMethodRequest Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.device.edge.DirectMethodRequest

public class DirectMethodRequest

Json parser for a method request. Used to invoke methods on other devices/modules

Constructor Summary

Constructor Description
DirectMethodRequest(String methodName, Object payload)

Constructor for a DirectMethodRequest. Uses default responseTimeout and connectionTimeout which is to never timeout

DirectMethodRequest(String methodName, Object payload, Integer responseTimeout, Integer connectionTimeout)

Constructor for a DirectMethodRequest.

Method Summary

Modifier and Type Method and Description
String toJson()

Return the json representation of this object

Constructor Details

DirectMethodRequest

public DirectMethodRequest(String methodName, Object payload)

Constructor for a DirectMethodRequest. Uses default responseTimeout and connectionTimeout which is to never timeout

Parameters:

methodName - the method to be invoked
payload - the payload attached to that method. This parameter can be Null: the DirectMethodRequest object will not include the "payload" field Primitive type (e.g., String, Int)/Array/List/Map/custom type: will be serialized as value of the "payload" field using GSON.

Throws:

IllegalArgumentException - if the provided methodName is null or empty

DirectMethodRequest

public DirectMethodRequest(String methodName, Object payload, Integer responseTimeout, Integer connectionTimeout)

Constructor for a DirectMethodRequest.

Parameters:

methodName - the method to be invoked
payload - the payload attached to that method. This parameter can be Null: the DirectMethodRequest object will not include the "payload" field Primitive type (e.g., String, Int)/Array/List/Map/custom type: will be serialized as value of the "payload" field using GSON.
responseTimeout - the timeout in seconds for the response to be received
connectionTimeout - the timeout in seconds for the connection to be established

Throws:

IllegalArgumentException - if the provided methodName is null or empty

Method Details

toJson

public String toJson()

Return the json representation of this object

Returns:

the json representation of this object

Applies to