@@ -39,6 +39,7 @@ def _validate_kwargs(exclude=[], **kwargs):
3939 "auto_connect" ,
4040 "connection_retry" ,
4141 "connection_retry_interval" ,
42+ "ensure_desired_properties" ,
4243 ]
4344
4445 for kwarg in kwargs :
@@ -59,6 +60,7 @@ def _get_config_kwargs(**kwargs):
5960 "auto_connect" ,
6061 "connection_retry" ,
6162 "connection_retry_interval" ,
63+ "ensure_desired_properties" ,
6264 ]
6365
6466 config_kwargs = {}
@@ -264,6 +266,8 @@ def create_from_connection_string(cls, connection_string, **kwargs):
264266 :param bool connection_retry: Attempt to re-establish a dropped connection (Default: True)
265267 :param int connection_retry_interval: Interval, in seconds, between attempts to
266268 re-establish a dropped connection (Default: 10)
269+ :param bool ensure_desired_properties: Ensure the most recent desired properties patch has
270+ been received upon re-connections (Default:True)
267271
268272 :raises: ValueError if given an invalid connection_string.
269273 :raises: TypeError if given an unsupported parameter.
@@ -345,6 +349,8 @@ def create_from_sastoken(cls, sastoken, **kwargs):
345349 :param bool connection_retry: Attempt to re-establish a dropped connection (Default: True)
346350 :param int connection_retry_interval: Interval, in seconds, between attempts to
347351 re-establish a dropped connection (Default: 10)
352+ :param bool ensure_desired_properties: Ensure the most recent desired properties patch has
353+ been received upon re-connections (Default:True)
348354
349355 :raises: TypeError if given an unsupported parameter.
350356 :raises: ValueError if the sastoken parameter is invalid.
@@ -554,6 +560,8 @@ def create_from_x509_certificate(cls, x509, hostname, device_id, **kwargs):
554560 :param bool connection_retry: Attempt to re-establish a dropped connection (Default: True)
555561 :param int connection_retry_interval: Interval, in seconds, between attempts to
556562 re-establish a dropped connection (Default: 10)
563+ :param bool ensure_desired_properties: Ensure the most recent desired properties patch has
564+ been received upon re-connections (Default:True)
557565
558566 :raises: TypeError if given an unsupported parameter.
559567
@@ -569,6 +577,7 @@ def create_from_x509_certificate(cls, x509, hostname, device_id, **kwargs):
569577 device_id = device_id , hostname = hostname , x509 = x509 , ** config_kwargs
570578 )
571579 pipeline_configuration .blob_upload = True # Blob Upload is a feature on Device Clients
580+ pipeline_configuration .ensure_desired_properties = True
572581
573582 # Pipeline setup
574583 http_pipeline = pipeline .HTTPPipeline (pipeline_configuration )
@@ -611,6 +620,8 @@ def create_from_symmetric_key(cls, symmetric_key, hostname, device_id, **kwargs)
611620 :param bool connection_retry: Attempt to re-establish a dropped connection (Default: True)
612621 :param int connection_retry_interval: Interval, in seconds, between attempts to
613622 re-establish a dropped connection (Default: 10)
623+ :param bool ensure_desired_properties: Ensure the most recent desired properties patch has
624+ been received upon re-connections (Default:True)
614625
615626 :raises: TypeError if given an unsupported parameter.
616627 :raises: ValueError if the provided parameters are invalid.
@@ -637,6 +648,7 @@ def create_from_symmetric_key(cls, symmetric_key, hostname, device_id, **kwargs)
637648 device_id = device_id , hostname = hostname , sastoken = sastoken , ** config_kwargs
638649 )
639650 pipeline_configuration .blob_upload = True # Blob Upload is a feature on Device Clients
651+ pipeline_configuration .ensure_desired_properties = True
640652
641653 # Pipeline setup
642654 http_pipeline = pipeline .HTTPPipeline (pipeline_configuration )
@@ -799,6 +811,8 @@ def create_from_edge_environment(cls, **kwargs):
799811 server_verification_cert = server_verification_cert ,
800812 ** config_kwargs
801813 )
814+ pipeline_configuration .ensure_desired_properties = True
815+
802816 pipeline_configuration .method_invoke = (
803817 True # Method Invoke is allowed on modules created from edge environment
804818 )
@@ -847,6 +861,8 @@ def create_from_x509_certificate(cls, x509, hostname, device_id, module_id, **kw
847861 :param bool connection_retry: Attempt to re-establish a dropped connection (Default: True)
848862 :param int connection_retry_interval: Interval, in seconds, between attempts to
849863 re-establish a dropped connection (Default: 10)
864+ :param bool ensure_desired_properties: Ensure the most recent desired properties patch has
865+ been received upon re-connections (Default:True)
850866
851867 :raises: TypeError if given an unsupported parameter.
852868
@@ -861,6 +877,7 @@ def create_from_x509_certificate(cls, x509, hostname, device_id, module_id, **kw
861877 pipeline_configuration = pipeline .IoTHubPipelineConfig (
862878 device_id = device_id , module_id = module_id , hostname = hostname , x509 = x509 , ** config_kwargs
863879 )
880+ pipeline_configuration .ensure_desired_properties = True
864881
865882 # Pipeline setup
866883 http_pipeline = pipeline .HTTPPipeline (pipeline_configuration )
0 commit comments