@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindAsyncHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
httpClientBinder(binder).bindAsyncHttpClient("global", Global.class);
@Override public void configure(Binder binder) { // bind service inventory binder.bind(ServiceInventory.class).in(Scopes.SINGLETON); bindConfig(binder).to(ServiceInventoryConfig.class); // for legacy configurations bindConfig(binder).to(DiscoveryClientConfig.class); // bind discovery client and dependencies binder.bind(DiscoveryLookupClient.class).to(HttpDiscoveryLookupClient.class).in(Scopes.SINGLETON); binder.bind(DiscoveryAnnouncementClient.class).to(HttpDiscoveryAnnouncementClient.class).in(Scopes.SINGLETON); jsonCodecBinder(binder).bindJsonCodec(ServiceDescriptorsRepresentation.class); jsonCodecBinder(binder).bindJsonCodec(Announcement.class); // bind the http client httpClientBinder(binder).bindAsyncHttpClient("discovery", ForDiscoveryClient.class); // bind announcer binder.bind(Announcer.class).in(Scopes.SINGLETON); // Must create a multibinder for service announcements or construction will fail if no // service announcements are bound, which is legal for processes that don't have public services Multibinder.newSetBinder(binder, ServiceAnnouncement.class); binder.bind(ServiceSelectorFactory.class).to(CachingServiceSelectorFactory.class).in(Scopes.SINGLETON); MBeanModule.newExporter(binder).export(ServiceInventory.class).withGeneratedName(); }
@Override public void configure(Binder binder) { httpClientBinder(binder).bindAsyncHttpClient("foo", FooClient.class) .withAlias(FooAlias1.class) .withAlias(FooAlias2.class); } },
@Override public void configure(Binder binder) { httpClientBinder(binder).bindAsyncHttpClient("foo", FooClient.class) .withFilter(TestingRequestFilter.class) .withFilter(AnotherHttpRequestFilter.class) .withTracing(); } },