Skip to content

Instantly share code, notes, and snippets.

@aia
Last active December 27, 2015 14:39
Show Gist options
  • Save aia/7341522 to your computer and use it in GitHub Desktop.
Save aia/7341522 to your computer and use it in GitHub Desktop.
require 'java'
require 'wealthfront-backend-fatjar'
class EMR::Monitor::InjectorModule < com.google.inject.AbstractModule
def configure
options = com.kaching.platform.guice.ApplicationOptions.new
options.configuration = "/path/to/config/configuration.properties"
options.loadConfigurationFromFile = true
install(com.kaching.platform.guice.CommonModule.new(options))
install(build_service_module(options))
end
def build_service_module(options)
builder = com.kaching.platform.guice.ServiceModuleBuilder.new(options)
builder.announceAs(
com.kaching.platform.guice.KachingServices::EMRM.java_class
)
builder.build
end
end
module EMR::Monitor
class << self; attr_accessor :injector; end
end
EMR::Monitor.injector = com.google.inject.Guice.createInjector(
[EMR::Monitor::InjectorModule.new]
)
EMR::Monitor.injector.getInstance(
com.kaching.platform.zk.ZkLifecycle.java_class
).start
announcement = EMR::Monitor.injector.getInstance(
com.kaching.platform.discovery.LocalAnnouncement.java_class
)
announcement.setStatus(org.fishwife.jrugged.Status::UP)
announcement.announce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment