.. because it simplifies our code a lot and frees us from maintaining ZooKeeper-handling code. i.e. less bugs and test failures.
Note about dependencies:
The following would be the only dependencies involved:
curator-frameworkcurator-clientzookeeperslf4j-apiWe can exclude the following transitive dependencies, due to sorry state of ZooKeeper and Curator POM:
guava (build-time only dependency since it's shaded)log4j (test-time only dependency)slf4j-log4j12 (test-time only dependency)netty (optional dependency)audience-annotations (documentation-purpose only)jline (only used for command line tools?)Hello. I am currently working on this issue. Before progress more, I would like to ask some questions.
As all of you know, apache curator provides its core package (curator-client) with its high-level module, curator-x-discovery, which serves the Service Discovery feature.
My question is: Should we adapt curator-x-discovery for armeria's service discovery feature? There are pros and cons for each of strategy.
The one thing that should be noted is that We have to support the other Service Discovery frameworks in the future (issue https://github.com/line/armeria/issues/194). That is, avoiding curator-x-discovery does not eliminate the potential to make some changes to current Service Discovery API. If we support other Service Discovery Service (for both of registration/resolving), defining a new API would be required at some point.
curator-x-discovery looks great, but it doesn't look compatible with how we store the server list in ZooKeeper. How about implementing both - one that's backward-compatible with the current implementation and the other that uses curator-x-discovery? It's OK to break the API compatibility as long as the data layout is compatible. If you are not interested in implemeting two, then you can just implement one you prefer.
It's almost done. I expect that I can open the pull request in next week.
However, I have a question: In the current work, I implemented ServerListenerBuilder which creates ServerListener instance by composing Runnable instances. Is this okay?
The reason why I concluded that we need such a thing follows. As all of you know, using Curator Framework with Armeria means that we have to define some ServerListener instances that start/stops one or more Curator instances[^1]. After writing those kinds of code one by one, I concluded that this way would be better:
ServerListener by composing Runnable instances in the core package.[^2]CuratorFramework instance in armeria-zookeeper, on top of 1.Runnables on other curator-recipes instances to 2. (Optional)CuratorFramework.How do you think? If you agree with 1, it would be better to open a separate issue - then I will open a PR on it first.
+1. I also concluded that CuratorFramework is sufficient for our Service Discovery feature - so we don't need curator-x-discovery module.
However, I have a question: In the current work, I implemented
ServerListenerBuilderwhich createsServerListenerinstance by composingRunnableinstances. Is this okay?
That sounds interesting enough for a separate issue. Could you create a new issue and propose your idea there? (Example code preferred.)
I opened #1003 with an implementation. Please take a look when you are free.
Most helpful comment
+1. I also concluded that
CuratorFrameworkis sufficient for our Service Discovery feature - so we don't need curator-x-discovery module.