OK... getting closer to this.
My issue now is that most of my objects are requiring custom initialization.
For example, with cassandra I have to read the config in, create a cluster
builder, set the options for the connection, then build a new session and
cluster object.
I could use @Provides
Hm.. only that won't work... I guess this is due to type erasure? fun!
com.google.inject.CreationException: Unable to create injector, see the
following errors:
1) T cannot be used as a key; It is not fully specified.
On Thursday, October 2, 2014 11:20:10 PM UTC-7, Kevin Burton wrote:
OK...
On Fri, Oct 3, 2014 at 8:26 AM, Kevin Burton burtona...@gmail.com wrote:
Hm.. only that won't work... I guess this is due to type erasure? fun!
com.google.inject.CreationException: Unable to create injector, see the
following errors:
1) T cannot be used as a key; It is not fully specified.
As mentioned earlier, doing this is as simple as:
// In each module that has a service:
MultibinderService multibinder = Multibinder.newSetBinder(binder(),
Service.class);
multibinder.addBinding().to(MyService.class);
// In one main module:
@Provides ServiceManager
I have a bunch of services that need to be started and stopped. ActiveMQ ,
Cassandra, Jetty, etc...
They use files, start ports, etc.
I imagine the best strategy to just have a leif Node service just start its
dependencies in its start() method.. then stop them.
So the could would look
One decent approach is to use Guava's Service ServiceManager
https://code.google.com/p/guava-libraries/wiki/ServiceExplained, then
bind your services using a multibinder and @Provides a ServiceManager
constructed with the result of that multibinder. Then you can just
start/stop the
I've spoken about my approach to this elsewhere, apologies if you've
already come across this. I use Dropwizard which has a concept of Managed
classes which get started and stopped by dropwizard. Though, you could do
something like this yourself too if you are opposed to dropwizard.
My abstract