I agree with Enrico that it's better to have a config option.

Also, we cannot simply replace the PulsarVersion call with the
DynamicPulsarVersion call because the client version string is now
constructed as:

String.format("Pulsar-Java-v%s", PulsarVersion.getVersion())

It's a config of client version string, not pulsar version.

Moreover, in your proposal, you mention the case of client c++ at first,
but don't talk about it later. Is the scope of this proposal in the Java
client only?

Best,
tison.


Enrico Olivelli <eolive...@gmail.com> 于2023年3月4日周六 06:38写道:

> Yunze,
>
> Il Ven 3 Mar 2023, 12:31 Yunze Xu <y...@streamnative.io.invalid> ha
> scritto:
>
> > Hi all,
> >
> > Based on the previous discussion [1], I created a proposal to support
> > configuring client version at SDK level:
> > https://github.com/apache/pulsar/issues/19705
> >
> > I've added more explanations in the motivation part, let's use this
> > PIP as a subsequent discussion of [1].
> >
> > BTW, there is a PR [2] in the pulsar-client-cpp repo because the
> > motivation is more meaningful for the C++ client.
> >
>
> I understand well this problem, we have it for the cited clients but I also
> see the same issue for other libraries based on the Java client, like the
> official Apache Pulsar Reactive client.
>
> I also see this problem in Startlight for JMS that is a JMS client for
> Pulsar that is based on the Java client.
>
> While I agree on the problem and on the solution I think that a static
> field is not enough, we have some problems:
>
> 1) there may be multiple usages of the Java client in the same JVM, and you
> want each client to report correctly its version
>
> 2) we would need to use the Java security Manager in order to prevent
> malicious code to modify the version or some other mechanism to prevent
> overriding the version.
>
> I believe that in the case of the Java client is is easier to add a
> configuration entry to the Pulsar Client Configuration. That would become a
> field in the JavaClient. So each instance can declare its version and also
> malicious code won't be able ti easily tweak the version (because it won't
> be a simple static method call)
>
> Enrico
>
>
>
> > [1] https://lists.apache.org/thread/n59k537fhthjnzkfxtc2p4zk4l0cv3mp
> > [2] https://github.com/apache/pulsar-client-cpp/pull/208
> >
> > Thanks!
> >
>

Reply via email to