All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.graylog2.telemetry.server.TelemetryServerModule Maven / Gradle / Ivy

package org.graylog2.telemetry.server;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.squareup.okhttp.OkHttpClient;
import org.graylog2.plugin.PluginConfigBean;
import org.graylog2.plugin.PluginModule;
import org.graylog2.telemetry.TelemetryConfiguration;
import org.graylog2.telemetry.TelemetryNodePeriodical;
import org.graylog2.telemetry.TelemetryNodeService;
import org.graylog2.telemetry.providers.ObjectMapperProvider;
import org.graylog2.telemetry.providers.OkHttpClientProvider;

import java.util.Collections;
import java.util.Set;

import static com.google.inject.name.Names.named;

public class TelemetryServerModule extends PluginModule {
    @Override
    public Set getConfigBeans() {
        return Collections.singleton(new TelemetryConfiguration());
    }

    @Override
    protected void configure() {
        bind(ObjectMapper.class).annotatedWith(named("telemetryObjectMapper")).toProvider(ObjectMapperProvider.class);
        bind(OkHttpClient.class).annotatedWith(named("telemetryHttpClient")).toProvider(OkHttpClientProvider.class);

        bind(TelemetryNodeService.class).asEagerSingleton();
        bind(TelemetryClusterService.class).asEagerSingleton();

        addPeriodical(TelemetryNodePeriodical.class);
        addPeriodical(TelemetryClusterPeriodical.class);
        addRestResource(TelemetryServerResource.class);

        addConfigBeans();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy