@@ -489,7 +489,9 @@ def __init__(self, service_url,
489489 tls_validate_hostname = False ,
490490 logger = None ,
491491 connection_timeout_ms = 10000 ,
492- listener_name = None
492+ listener_name = None ,
493+ tls_private_key_file_path : Optional [str ] = None ,
494+ tls_certificate_file_path : Optional [str ] = None ,
493495 ):
494496 """
495497 Create a new Pulsar client instance.
@@ -555,6 +557,10 @@ def __init__(self, service_url,
555557 Listener name for lookup. Clients can use listenerName to choose one of the listeners as
556558 the service URL to create a connection to the broker as long as the network is accessible.
557559 ``advertisedListeners`` must be enabled in broker side.
560+ tls_private_key_file_path: str, optional
561+ The path to the TLS private key file
562+ tls_certificate_file_path: str, optional
563+ The path to the TLS certificate file.
558564 """
559565 _check_type (str , service_url , 'service_url' )
560566 _check_type_or_none (Authentication , authentication , 'authentication' )
@@ -570,6 +576,8 @@ def __init__(self, service_url,
570576 _check_type (bool , tls_allow_insecure_connection , 'tls_allow_insecure_connection' )
571577 _check_type (bool , tls_validate_hostname , 'tls_validate_hostname' )
572578 _check_type_or_none (str , listener_name , 'listener_name' )
579+ _check_type_or_none (str , tls_private_key_file_path , 'tls_private_key_file_path' )
580+ _check_type_or_none (str , tls_certificate_file_path , 'tls_certificate_file_path' )
573581
574582 conf = _pulsar .ClientConfiguration ()
575583 if authentication :
@@ -601,6 +609,10 @@ def __init__(self, service_url,
601609 conf .tls_trust_certs_file_path (certifi .where ())
602610 conf .tls_allow_insecure_connection (tls_allow_insecure_connection )
603611 conf .tls_validate_hostname (tls_validate_hostname )
612+ if tls_private_key_file_path is not None :
613+ conf .tls_private_key_file_path (tls_private_key_file_path )
614+ if tls_certificate_file_path is not None :
615+ conf .tls_certificate_file_path (tls_certificate_file_path )
604616 self ._client = _pulsar .Client (service_url , conf )
605617 self ._consumers = []
606618
0 commit comments