Coder Social home page Coder Social logo

Configuration should be immutable about pulsar HOT 7 CLOSED

apache avatar apache commented on June 20, 2024 1
Configuration should be immutable

from pulsar.

Comments (7)

merlimat avatar merlimat commented on June 20, 2024

Typesafe config looks like a very nice written library.

For broker config, I'd be ok to use it to populate the ServiceConfiguration. I'd like to maintain to have a single point to have to update when adding a new config variable. Currently, ServiceConfiguration is a pojo, and you just need to add a new variable with default value and example in conf/broker.conf.

Alternatively, what about having ServiceConfiguration with only getters and adding a ServiceConfigurationBuilder?

from pulsar.

radekg avatar radekg commented on June 20, 2024

Pushed the branch to remote but no pr, just so you can have a look. The most interesting points:

This isn't a finished PR, tests need much more work. Also, the validation of minValue and maxValue isn't implemented but would be rather straightforward to implement.

To comply with what Typesafe Config needs, we would have to add reference.conf file to the resources.

Have a look, let me know what you think.

from pulsar.

merlimat avatar merlimat commented on June 20, 2024

For config file, would it be possible to maintain the same java properties format? That would keep it consistent with the other config files (client, bookkeeper, ..). It seems the only change is right now the pulsar {....} enclosing namespace.

I think that having to specify the config var name (either a string or a constant), makes a it bit more complicated to configure programmatically, since you have to lookup for the list of allowed variables, while with setters it's easy to discover all the options.

from pulsar.

merlimat avatar merlimat commented on June 20, 2024

But other than the 2 notes above, it seems nice to combine multiple config sources

from pulsar.

radekg avatar radekg commented on June 20, 2024

@merlimat I'd suggest using the hocon format across all configuration. The reason is that if someone builds software where Pulsar is only one of the components using Typesafe Config, they can single hocon file for all their components. We can keep the properties look and feel but, at least, I'd suggest prefixing all settings with pulsar. to give them a namespace.

As for having to know the property names, yes, this is slightly inconvenient but, I think, you are looking from the perspective of unit tests. Preferably, all configuration variants would come as a separate .conf file. Combined with a reference.conf, everything is covered. However, if that is not enough, we can always implement a builder which would construct the necessary properties. The base is what it is, how config properties are constructed, we can change that to a friendlier looking version.

Shall I come up with a full PR?

from pulsar.

merlimat avatar merlimat commented on June 20, 2024

I would rather not break the config file compatibility unless is really necessary. Also, the other concern is that bookkeeper.conf and zookeeper.conf will still be in Java properties format and that cannot be easily changed.

from pulsar.

ivankelly avatar ivankelly commented on June 20, 2024

This seems to have gone quiet. Closing. Please reopen if you want this work to continue.

from pulsar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.