Search in sources :

Example 1 with NingHttpClient

use of com.hubspot.horizon.ning.NingHttpClient in project Singularity by HubSpot.

the class SingularityMesosClientModule method configure.

@Override
protected void configure() {
    ObjectMapper objectMapper = JavaUtils.newObjectMapper();
    HttpConfig httpConfig = HttpConfig.newBuilder().setObjectMapper(objectMapper).build();
    HttpClient httpClient = new NingHttpClient(httpConfig);
    bind(ObjectMapper.class).annotatedWith(Names.named(MESOS_CLIENT_OBJECT_MAPPER)).toInstance(objectMapper);
    bind(HttpClient.class).annotatedWith(Names.named(SingularityMesosClient.HTTP_CLIENT_NAME)).toInstance(httpClient);
    bind(MesosClient.class).to(SingularityMesosClient.class).in(Scopes.SINGLETON);
}
Also used : NingHttpClient(com.hubspot.horizon.ning.NingHttpClient) HttpClient(com.hubspot.horizon.HttpClient) NingHttpClient(com.hubspot.horizon.ning.NingHttpClient) HttpConfig(com.hubspot.horizon.HttpConfig) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with NingHttpClient

use of com.hubspot.horizon.ning.NingHttpClient in project Singularity by HubSpot.

the class SingularityClientModule method configure.

@Override
protected void configure() {
    ObjectMapper objectMapper = JavaUtils.newObjectMapper();
    HttpClient httpClient = new NingHttpClient(httpConfig.or(HttpConfig.newBuilder().setObjectMapper(objectMapper).build()));
    bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);
    bind(SingularityClient.class).toProvider(SingularityClientProvider.class).in(Scopes.SINGLETON);
    if (hosts != null) {
        bindHosts(binder()).toInstance(hosts);
    }
}
Also used : NingHttpClient(com.hubspot.horizon.ning.NingHttpClient) HttpClient(com.hubspot.horizon.HttpClient) NingHttpClient(com.hubspot.horizon.ning.NingHttpClient) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 HttpClient (com.hubspot.horizon.HttpClient)2 NingHttpClient (com.hubspot.horizon.ning.NingHttpClient)2 HttpConfig (com.hubspot.horizon.HttpConfig)1