Hi,
Just wanted to know if elasticsearch is moving away from using Guice to wire dependencies? If yes, are there any discussion posts where I can read more about the reasons behind it?
Thanks.
Hi,
Just wanted to know if elasticsearch is moving away from using Guice to wire dependencies? If yes, are there any discussion posts where I can read more about the reasons behind it?
Thanks.
For some developer comments about dependency injection modules in ES, see
Please note that ES has always used an older (and somewhat optimized) shadowed version of Guice 2 while Guice is now at 4.1. This brought some challenges concerning the tracing and backporting of fixed bugs, see https://github.com/elastic/elasticsearch/issues/283 and https://github.com/elastic/elasticsearch/pull/17921
Thanks Jörg, that was helpful.
Is the plan to completely remove Guice from the elasticsearch codebase in favour of constructor injection by hand, or to have a small set of modules for top level services (e.g. SearchModule, TransportModule) that has a flat structure and then use Guice to wire only these top level modules and use @Inject for their discovery?
If you are completely removing Guice, then what approach are you taking to lookup (inject) a specific service from a different service?
I can not speak for the ES developers but what I can read between the lines is that Guice shall completely disappear in 5.0
From ES plugin developer perspective, I'm bound to that decision and I hope I can navigate through the labyrinth of factories, registries, modules and services that would have to be wired by hand into the code - kind of a struggle, like back in the old days of Java 2 and J2EE. But, I understand that because Guice ignores plugin isolation and collides with classloading as long as the software around Guice is not providing classloader separated dependency injection aka "everything is a plugin" design pattern, which ES never tried consequently enough. I mean, initiate plugin code first, then create separate Guice injectors each with all ES modules for each plugin. Instead, all plugins were considered a module within the Guice hierarchy.
From the perspective as a great fan of the magic of Guice (and Guava), I would have to follow my own code base in order to use Guice again, which means, wrap my own code base around Elasticsearch, including a web app platform with plugins, custom bootstrapping (aka embedding Elasticsearch) - yes, reinventing the wheel. I doubt this could be a satisfying solution for everyone.
I haven't tried ES 5.0 - it is moving too fast and it collides with several other projects in my timeline - so I am still confident all will work out well in the end.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.