You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by Baodi Shi <ba...@apache.org> on 2023/03/13 14:24:09 UTC

[DISCUSS] PIP-258: Deprecation of the consumer subscribeTopicMode configuration

Hi all,

I've started a PIP to discuss: PIP-258: Deprecation of the consumer
subscribeTopicMode configuration

### Motivation

About pattern subscribes of consumers, the `topicsPattern` and
`subscribeTopicMode` configurations are contradictory.

For example, the `topicsPattern` represents only subscription to
`persistent topic`, but the `subscriptionTopicsMode` represents
subscription to `all topic`.

``` java
Pattern pattern =
Pattern.compile("persistent://my-property/my-ns/pattern-topic.*");
Consumer<byte[]> consumer = pulsarClient.newConsumer()
            .topicsPattern(pattern)
            .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
            .build();
```

Finally, `all topics` are subscribed. It's very confusing.


For more details, please read the PIP at
https://github.com/apache/pulsar/issues/19798
<https://github.com/apache/pulsar/issues/19601>


Thanks,
Baodi Shi

Re: [DISCUSS] PIP-258: Deprecation of the consumer subscribeTopicMode configuration

Posted by Baodi Shi <ba...@apache.org>.
>
> I think we don't need to do such changes. Instead, we should fix the
> documentation of `ConsumerBuilder#topicsPattern`. From the
> implementation here [1], the prefix before "://" in the topic pattern
> should be ignored.
>


Agree, We can also add the warn log when the user-configured pattern
contains a domain(‘persistent://public/default/topic
<persistent://public/default/topic->.*')

We can close that PIP and discuss.

Thanks,
Baodi Shi


在 2023年3月24日 19:40:15 上,Yunze Xu <yz...@streamnative.io.invalid> 写道:

> I think we don't need to do such changes. Instead, we should fix the
> documentation of `ConsumerBuilder#topicsPattern`. From the
> implementation here [1], the prefix before "://" in the topic pattern
> should be ignored.
>
> [1]
> https://github.com/apache/pulsar/blob/f1f8dab972b098be69ad35ab3d307f19284c4e48/pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java#L56
>
> Thanks,
> Yunze
>
> On Mon, Mar 20, 2023 at 9:32 AM Baodi Shi <ba...@apache.org> wrote:
>
>
> >
>
> > Should we state in the PIP which version it will be removed?
>
> >
>
>
> I think adding is best, but I'm not quite sure which version we should be
>
> specific to. How about v3.2.0? Wait for 2 major versions (3.0.0 and 3.1.0)
>
>
> Thanks,
>
> Baodi Shi
>
>
>
> 在 2023年3月17日 15:16:19 上,Zike Yang <zi...@apache.org> 写道:
>
>
> > LGTM. +1
>
> > It will make the API clearer without bringing breaking changes.
>
> >
>
> >  After the configuration is removed in subsequent versions, it will be
>
> > clearer
>
> >
>
> >
>
> > Should we state in the PIP which version it will be removed?
>
> >
>
> > Thanks,
>
> > Zike Yang
>
> >
>
> > On Fri, Mar 17, 2023 at 8:50 AM Baodi Shi <ba...@apache.org> wrote:
>
> >
>
> >
>
> > Hi, Any ideas please discuss, thanks.
>
> >
>
> >
>
> > Thanks,
>
> >
>
> > Baodi Shi
>
> >
>
> >
>
> >
>
> > 在 2023年3月13日 22:24:09 上,Baodi Shi <ba...@apache.org> 写道:
>
> >
>
> >
>
> > > Hi all,
>
> >
>
> > >
>
> >
>
> > > I've started a PIP to discuss: PIP-258: Deprecation of the consumer
>
> >
>
> > > subscribeTopicMode configuration
>
> >
>
> > >
>
> >
>
> > > ### Motivation
>
> >
>
> > >
>
> >
>
> > > About pattern subscribes of consumers, the `topicsPattern` and
>
> >
>
> > > `subscribeTopicMode` configurations are contradictory.
>
> >
>
> > >
>
> >
>
> > > For example, the `topicsPattern` represents only subscription to
>
> >
>
> > > `persistent topic`, but the `subscriptionTopicsMode` represents
>
> >
>
> > > subscription to `all topic`.
>
> >
>
> > >
>
> >
>
> > > ``` java
>
> >
>
> > > Pattern pattern =
>
> >
>
> > > Pattern.compile("persistent://my-property/my-ns/pattern-topic.*");
>
> >
>
> > > Consumer<byte[]> consumer = pulsarClient.newConsumer()
>
> >
>
> > >             .topicsPattern(pattern)
>
> >
>
> > >             .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
>
> >
>
> > >             .build();
>
> >
>
> > > ```
>
> >
>
> > >
>
> >
>
> > > Finally, `all topics` are subscribed. It's very confusing.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > For more details, please read the PIP at
>
> >
>
> > > https://github.com/apache/pulsar/issues/19798
>
> >
>
> > > <https://github.com/apache/pulsar/issues/19601>
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Thanks,
>
> >
>
> > > Baodi Shi
>
> >
>
> > >
>
> >
>
> >
>
>

Re: [DISCUSS] PIP-258: Deprecation of the consumer subscribeTopicMode configuration

Posted by Yunze Xu <yz...@streamnative.io.INVALID>.
I think we don't need to do such changes. Instead, we should fix the
documentation of `ConsumerBuilder#topicsPattern`. From the
implementation here [1], the prefix before "://" in the topic pattern
should be ignored.

[1] https://github.com/apache/pulsar/blob/f1f8dab972b098be69ad35ab3d307f19284c4e48/pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java#L56

Thanks,
Yunze

On Mon, Mar 20, 2023 at 9:32 AM Baodi Shi <ba...@apache.org> wrote:
>
> >
> > Should we state in the PIP which version it will be removed?
> >
>
> I think adding is best, but I'm not quite sure which version we should be
> specific to. How about v3.2.0? Wait for 2 major versions (3.0.0 and 3.1.0)
>
> Thanks,
> Baodi Shi
>
>
> 在 2023年3月17日 15:16:19 上,Zike Yang <zi...@apache.org> 写道:
>
> > LGTM. +1
> > It will make the API clearer without bringing breaking changes.
> >
> >  After the configuration is removed in subsequent versions, it will be
> > clearer
> >
> >
> > Should we state in the PIP which version it will be removed?
> >
> > Thanks,
> > Zike Yang
> >
> > On Fri, Mar 17, 2023 at 8:50 AM Baodi Shi <ba...@apache.org> wrote:
> >
> >
> > Hi, Any ideas please discuss, thanks.
> >
> >
> > Thanks,
> >
> > Baodi Shi
> >
> >
> >
> > 在 2023年3月13日 22:24:09 上,Baodi Shi <ba...@apache.org> 写道:
> >
> >
> > > Hi all,
> >
> > >
> >
> > > I've started a PIP to discuss: PIP-258: Deprecation of the consumer
> >
> > > subscribeTopicMode configuration
> >
> > >
> >
> > > ### Motivation
> >
> > >
> >
> > > About pattern subscribes of consumers, the `topicsPattern` and
> >
> > > `subscribeTopicMode` configurations are contradictory.
> >
> > >
> >
> > > For example, the `topicsPattern` represents only subscription to
> >
> > > `persistent topic`, but the `subscriptionTopicsMode` represents
> >
> > > subscription to `all topic`.
> >
> > >
> >
> > > ``` java
> >
> > > Pattern pattern =
> >
> > > Pattern.compile("persistent://my-property/my-ns/pattern-topic.*");
> >
> > > Consumer<byte[]> consumer = pulsarClient.newConsumer()
> >
> > >             .topicsPattern(pattern)
> >
> > >             .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
> >
> > >             .build();
> >
> > > ```
> >
> > >
> >
> > > Finally, `all topics` are subscribed. It's very confusing.
> >
> > >
> >
> > >
> >
> > > For more details, please read the PIP at
> >
> > > https://github.com/apache/pulsar/issues/19798
> >
> > > <https://github.com/apache/pulsar/issues/19601>
> >
> > >
> >
> > >
> >
> > > Thanks,
> >
> > > Baodi Shi
> >
> > >
> >
> >

Re: [DISCUSS] PIP-258: Deprecation of the consumer subscribeTopicMode configuration

Posted by Baodi Shi <ba...@apache.org>.
>
> Should we state in the PIP which version it will be removed?
>

I think adding is best, but I'm not quite sure which version we should be
specific to. How about v3.2.0? Wait for 2 major versions (3.0.0 and 3.1.0)

Thanks,
Baodi Shi


在 2023年3月17日 15:16:19 上,Zike Yang <zi...@apache.org> 写道:

> LGTM. +1
> It will make the API clearer without bringing breaking changes.
>
>  After the configuration is removed in subsequent versions, it will be
> clearer
>
>
> Should we state in the PIP which version it will be removed?
>
> Thanks,
> Zike Yang
>
> On Fri, Mar 17, 2023 at 8:50 AM Baodi Shi <ba...@apache.org> wrote:
>
>
> Hi, Any ideas please discuss, thanks.
>
>
> Thanks,
>
> Baodi Shi
>
>
>
> 在 2023年3月13日 22:24:09 上,Baodi Shi <ba...@apache.org> 写道:
>
>
> > Hi all,
>
> >
>
> > I've started a PIP to discuss: PIP-258: Deprecation of the consumer
>
> > subscribeTopicMode configuration
>
> >
>
> > ### Motivation
>
> >
>
> > About pattern subscribes of consumers, the `topicsPattern` and
>
> > `subscribeTopicMode` configurations are contradictory.
>
> >
>
> > For example, the `topicsPattern` represents only subscription to
>
> > `persistent topic`, but the `subscriptionTopicsMode` represents
>
> > subscription to `all topic`.
>
> >
>
> > ``` java
>
> > Pattern pattern =
>
> > Pattern.compile("persistent://my-property/my-ns/pattern-topic.*");
>
> > Consumer<byte[]> consumer = pulsarClient.newConsumer()
>
> >             .topicsPattern(pattern)
>
> >             .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
>
> >             .build();
>
> > ```
>
> >
>
> > Finally, `all topics` are subscribed. It's very confusing.
>
> >
>
> >
>
> > For more details, please read the PIP at
>
> > https://github.com/apache/pulsar/issues/19798
>
> > <https://github.com/apache/pulsar/issues/19601>
>
> >
>
> >
>
> > Thanks,
>
> > Baodi Shi
>
> >
>
>

Re: [DISCUSS] PIP-258: Deprecation of the consumer subscribeTopicMode configuration

Posted by Zike Yang <zi...@apache.org>.
LGTM. +1
It will make the API clearer without bringing breaking changes.

>  After the configuration is removed in subsequent versions, it will be clearer

Should we state in the PIP which version it will be removed?

Thanks,
Zike Yang

On Fri, Mar 17, 2023 at 8:50 AM Baodi Shi <ba...@apache.org> wrote:
>
> Hi, Any ideas please discuss, thanks.
>
> Thanks,
> Baodi Shi
>
>
> 在 2023年3月13日 22:24:09 上,Baodi Shi <ba...@apache.org> 写道:
>
> > Hi all,
> >
> > I've started a PIP to discuss: PIP-258: Deprecation of the consumer
> > subscribeTopicMode configuration
> >
> > ### Motivation
> >
> > About pattern subscribes of consumers, the `topicsPattern` and
> > `subscribeTopicMode` configurations are contradictory.
> >
> > For example, the `topicsPattern` represents only subscription to
> > `persistent topic`, but the `subscriptionTopicsMode` represents
> > subscription to `all topic`.
> >
> > ``` java
> > Pattern pattern =
> > Pattern.compile("persistent://my-property/my-ns/pattern-topic.*");
> > Consumer<byte[]> consumer = pulsarClient.newConsumer()
> >             .topicsPattern(pattern)
> >             .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
> >             .build();
> > ```
> >
> > Finally, `all topics` are subscribed. It's very confusing.
> >
> >
> > For more details, please read the PIP at
> > https://github.com/apache/pulsar/issues/19798
> > <https://github.com/apache/pulsar/issues/19601>
> >
> >
> > Thanks,
> > Baodi Shi
> >

Re: [DISCUSS] PIP-258: Deprecation of the consumer subscribeTopicMode configuration

Posted by Baodi Shi <ba...@apache.org>.
Hi, Any ideas please discuss, thanks.

Thanks,
Baodi Shi


在 2023年3月13日 22:24:09 上,Baodi Shi <ba...@apache.org> 写道:

> Hi all,
>
> I've started a PIP to discuss: PIP-258: Deprecation of the consumer
> subscribeTopicMode configuration
>
> ### Motivation
>
> About pattern subscribes of consumers, the `topicsPattern` and
> `subscribeTopicMode` configurations are contradictory.
>
> For example, the `topicsPattern` represents only subscription to
> `persistent topic`, but the `subscriptionTopicsMode` represents
> subscription to `all topic`.
>
> ``` java
> Pattern pattern =
> Pattern.compile("persistent://my-property/my-ns/pattern-topic.*");
> Consumer<byte[]> consumer = pulsarClient.newConsumer()
>             .topicsPattern(pattern)
>             .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
>             .build();
> ```
>
> Finally, `all topics` are subscribed. It's very confusing.
>
>
> For more details, please read the PIP at
> https://github.com/apache/pulsar/issues/19798
> <https://github.com/apache/pulsar/issues/19601>
>
>
> Thanks,
> Baodi Shi
>