|
48 | 48 | import _pulsar |
49 | 49 |
|
50 | 50 | from _pulsar import Result, CompressionType, ConsumerType, InitialPosition, PartitionsRoutingMode, BatchingType, \ |
51 | | - LoggerLevel, BatchReceivePolicy, KeySharedPolicy, KeySharedMode, ProducerAccessMode # noqa: F401 |
| 51 | + LoggerLevel, BatchReceivePolicy, KeySharedPolicy, KeySharedMode, ProducerAccessMode, RegexSubscriptionMode # noqa: F401 |
52 | 52 |
|
53 | 53 | from pulsar.__about__ import __version__ |
54 | 54 |
|
@@ -708,6 +708,7 @@ def subscribe(self, topic, subscription_name, |
708 | 708 | batch_receive_policy=None, |
709 | 709 | key_shared_policy=None, |
710 | 710 | batch_index_ack_enabled=False, |
| 711 | + regex_subscription_mode=RegexSubscriptionMode.PersistentOnly, |
711 | 712 | ): |
712 | 713 | """ |
713 | 714 | Subscribe to the given topic and subscription combination. |
@@ -819,9 +820,11 @@ def my_listener(consumer, message): |
819 | 820 | _check_type_or_none(ConsumerBatchReceivePolicy, batch_receive_policy, 'batch_receive_policy') |
820 | 821 | _check_type_or_none(ConsumerKeySharedPolicy, key_shared_policy, 'key_shared_policy') |
821 | 822 | _check_type(bool, batch_index_ack_enabled, 'batch_index_ack_enabled') |
| 823 | + _check_type(RegexSubscriptionMode, regex_subscription_mode, 'regex_subscription_mode') |
822 | 824 |
|
823 | 825 | conf = _pulsar.ConsumerConfiguration() |
824 | 826 | conf.consumer_type(consumer_type) |
| 827 | + conf.regex_subscription_mode(regex_subscription_mode) |
825 | 828 | conf.read_compacted(is_read_compacted) |
826 | 829 | if message_listener: |
827 | 830 | conf.message_listener(_listener_wrapper(message_listener, schema)) |
|
0 commit comments