@@ -440,6 +440,26 @@ def policy(self):
440
440
"""
441
441
return self ._policy
442
442
443
+ class CryptoKeyReader :
444
+ """
445
+ Default crypto key reader implementation
446
+ """
447
+ def __init__ (self , public_key_path , private_key_path ):
448
+ """
449
+ Create crypto key reader.
450
+
451
+ Parameters
452
+ ----------
453
+
454
+ public_key_path: str
455
+ Path to the public key
456
+ private_key_path: str
457
+ Path to private key
458
+ """
459
+ _check_type (str , public_key_path , 'public_key_path' )
460
+ _check_type (str , private_key_path , 'private_key_path' )
461
+ self .cryptoKeyReader = _pulsar .CryptoKeyReader (public_key_path , private_key_path )
462
+
443
463
class Client :
444
464
"""
445
465
The Pulsar client. A single client instance can be used to create producers
@@ -574,7 +594,7 @@ def create_producer(self, topic,
574
594
schema = schema .BytesSchema (),
575
595
initial_sequence_id = None ,
576
596
send_timeout_millis = 30000 ,
577
- compression_type = CompressionType .NONE ,
597
+ compression_type : CompressionType = CompressionType .NONE ,
578
598
max_pending_messages = 1000 ,
579
599
max_pending_messages_across_partitions = 50000 ,
580
600
block_if_queue_full = False ,
@@ -583,13 +603,13 @@ def create_producer(self, topic,
583
603
batching_max_allowed_size_in_bytes = 128 * 1024 ,
584
604
batching_max_publish_delay_ms = 10 ,
585
605
chunking_enabled = False ,
586
- message_routing_mode = PartitionsRoutingMode .RoundRobinDistribution ,
606
+ message_routing_mode : PartitionsRoutingMode = PartitionsRoutingMode .RoundRobinDistribution ,
587
607
lazy_start_partitioned_producers = False ,
588
608
properties = None ,
589
- batching_type = BatchingType .Default ,
609
+ batching_type : BatchingType = BatchingType .Default ,
590
610
encryption_key = None ,
591
- crypto_key_reader = None ,
592
- access_mode = ProducerAccessMode .Shared ,
611
+ crypto_key_reader : CryptoKeyReader = None ,
612
+ access_mode : ProducerAccessMode = ProducerAccessMode .Shared ,
593
613
):
594
614
"""
595
615
Create a new producer on a given topic.
@@ -752,7 +772,7 @@ def create_producer(self, topic,
752
772
return p
753
773
754
774
def subscribe (self , topic , subscription_name ,
755
- consumer_type = ConsumerType .Exclusive ,
775
+ consumer_type : ConsumerType = ConsumerType .Exclusive ,
756
776
schema = schema .BytesSchema (),
757
777
message_listener = None ,
758
778
receiver_queue_size = 1000 ,
@@ -764,16 +784,16 @@ def subscribe(self, topic, subscription_name,
764
784
is_read_compacted = False ,
765
785
properties = None ,
766
786
pattern_auto_discovery_period = 60 ,
767
- initial_position = InitialPosition .Latest ,
768
- crypto_key_reader = None ,
787
+ initial_position : InitialPosition = InitialPosition .Latest ,
788
+ crypto_key_reader : CryptoKeyReader = None ,
769
789
replicate_subscription_state_enabled = False ,
770
790
max_pending_chunked_message = 10 ,
771
791
auto_ack_oldest_chunked_message_on_queue_full = False ,
772
792
start_message_id_inclusive = False ,
773
793
batch_receive_policy = None ,
774
794
key_shared_policy = None ,
775
795
batch_index_ack_enabled = False ,
776
- regex_subscription_mode = RegexSubscriptionMode .PersistentOnly ,
796
+ regex_subscription_mode : RegexSubscriptionMode = RegexSubscriptionMode .PersistentOnly ,
777
797
dead_letter_policy : ConsumerDeadLetterPolicy = None ,
778
798
):
779
799
"""
@@ -966,7 +986,7 @@ def create_reader(self, topic, start_message_id,
966
986
reader_name = None ,
967
987
subscription_role_prefix = None ,
968
988
is_read_compacted = False ,
969
- crypto_key_reader = None ,
989
+ crypto_key_reader : CryptoKeyReader = None ,
970
990
start_message_id_inclusive = False
971
991
):
972
992
"""
@@ -1713,27 +1733,6 @@ def is_connected(self):
1713
1733
return self ._reader .is_connected ()
1714
1734
1715
1735
1716
- class CryptoKeyReader :
1717
- """
1718
- Default crypto key reader implementation
1719
- """
1720
- def __init__ (self , public_key_path , private_key_path ):
1721
- """
1722
- Create crypto key reader.
1723
-
1724
- Parameters
1725
- ----------
1726
-
1727
- public_key_path: str
1728
- Path to the public key
1729
- private_key_path: str
1730
- Path to private key
1731
- """
1732
- _check_type (str , public_key_path , 'public_key_path' )
1733
- _check_type (str , private_key_path , 'private_key_path' )
1734
- self .cryptoKeyReader = _pulsar .CryptoKeyReader (public_key_path , private_key_path )
1735
-
1736
-
1737
1736
class ConsoleLogger :
1738
1737
"""
1739
1738
Logger that writes on standard output
0 commit comments