Closed AlexThurston closed 9 years ago
The problem is the ElasticSearch verticle uses DI which won't work with the default vert.x JavaVerticleFactory
.
Take a look at this section: https://github.com/englishtown/vertx-elasticsearch-service/tree/1.3.0#dependency-injection-and-the-hk2verticlefactory
If you don't want to use HK2 or Guice (or any DI framework), you could wrap the com.englishtown.vertx.elasticsearch.ElasticSearch
verticle and provide instances of TransportClientFactory
and ElasticSearchConfigurator
yourself.
Hope this helps.
I've made some progress and now appear to be using the module successfully. However, I've got some other questions. There are perhaps not directly related to this module perse, but you've made the mistake of being helpful :)
I currently have a main "run" ruby file that deploys the various verticles. Some of these verticles are written in ruby and others are written in Java. If I change the langs.properties as suggested, things work but does that not mean that ALL my other java verticles will be using the HK2 DI framework? Is that bad?
I guess the crux of my issue is that I'd like to be able to deploy a module specifying the prefix. According to the Vert.x docs, I can do that with a verticle but it doesn't seem to work with a module. Basically I wanted to deploy your module with HK2 but continue to deploy the other java verticles using the stock Java instantiater.
I see this when I set java to the HK2 Factory in the langs.properties file:
HK2 bootstrap binder class com.englishtown.vertx.hk2.BootstrapBinder was not found. Are you missing injection bindings?
But the system still appears to be working just fine.
Unfortunately you can only choose one verticle factory per language with vert.x 2.x (as far as I know). This all changes with vert.x 3 (using prefixes as you mention), but that doesn't help you for the time being.
We run all our vert.x apps using the HK2VerticleFactory
. You can see the source code https://github.com/englishtown/vertx-hk2. All it does is create an HK2 ServiceLocator
, read any DI bindings that have been configured, and use that to instantiation the verticle. The same is true for the GuiceVerticleFactory
with a Guice Injector
.
We do everything in Java using DI, but I understand that is not everyone's architectural choice. If you don't want to use DI, you can get around it by creating your own module that wraps the ElasticSearch
verticle and you can instantiate the dependencies in your wrapper.
Feel free to re-open if you're still having issues.
Hey, If this happens to be user error, then I apologize in advance for wasting your time. I'm very interested in using this module but can't seem to get it to work and have tried several different ways.
The first was just running the module explicitly:
vertx runmod com.englishtown~vertx-mod-elasticsearch~1.3.0 -conf my.conf
my.conf contains:
This fails in the following manner:
No matter how I try to use the module, I continue to get that very same error. Any thoughts or insight on what I'm doing wrong. The exception doesn't really tell me where/what is the problem.
Again, sorry if this is something boneheaded.