Search in sources :

Example 1 with EventTypeMetadata

use of io.airlift.event.client.EventTypeMetadata in project airlift by airlift.

the class HttpEventModule method configure.

@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).bindHttpClient("event", ForEventClient.class);
    // Kick off the binding of Set<EventTypeMetadata> in case no events are bound
    newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {
    });
}
Also used : EventModule(io.airlift.event.client.EventModule) JsonEventWriter(io.airlift.event.client.JsonEventWriter) EventTypeMetadata(io.airlift.event.client.EventTypeMetadata) EventClient(io.airlift.event.client.EventClient) ForEventClient(io.airlift.event.client.ForEventClient)

Example 2 with EventTypeMetadata

use of io.airlift.event.client.EventTypeMetadata in project airlift by airlift.

the class TestHttpEventClient method newEventClient.

private HttpEventClient newEventClient(List<URI> uris) {
    HttpServiceSelector selector = new StaticHttpServiceSelector("collector", "general", uris);
    Set<EventTypeMetadata<?>> eventTypes = getValidEventTypeMetaDataSet(FixedDummyEventClass.class);
    JsonEventWriter eventWriter = new JsonEventWriter(eventTypes);
    return new HttpEventClient(selector, eventWriter, new NodeInfo("test"), httpClient);
}
Also used : NodeInfo(io.airlift.node.NodeInfo) JsonEventWriter(io.airlift.event.client.JsonEventWriter) StaticHttpServiceSelector(io.airlift.discovery.client.testing.StaticHttpServiceSelector) StaticHttpServiceSelector(io.airlift.discovery.client.testing.StaticHttpServiceSelector) HttpServiceSelector(io.airlift.discovery.client.HttpServiceSelector) EventTypeMetadata(io.airlift.event.client.EventTypeMetadata)

Aggregations

EventTypeMetadata (io.airlift.event.client.EventTypeMetadata)2 JsonEventWriter (io.airlift.event.client.JsonEventWriter)2 HttpServiceSelector (io.airlift.discovery.client.HttpServiceSelector)1 StaticHttpServiceSelector (io.airlift.discovery.client.testing.StaticHttpServiceSelector)1 EventClient (io.airlift.event.client.EventClient)1 EventModule (io.airlift.event.client.EventModule)1 ForEventClient (io.airlift.event.client.ForEventClient)1 NodeInfo (io.airlift.node.NodeInfo)1