Beispiel #1
0
  private void initializeEmitter() {
    if (emitter == null) {
      final HttpClient httpClient =
          HttpClientInit.createClient(
              HttpClientConfig.builder().withNumConnections(1).build(), lifecycle);

      emitter =
          new ServiceEmitter(
              PropUtils.getProperty(props, "druid.service"),
              PropUtils.getProperty(props, "druid.host"),
              Emitters.create(props, httpClient, jsonMapper, lifecycle));
    }
    EmittingLogger.registerEmitter(emitter);
  }
Beispiel #2
0
  @Provides
  @ManageLifecycle
  @Named("http")
  public Emitter getEmitter(
      Supplier<HttpEmitterConfig> config,
      @Nullable SSLContext sslContext,
      Lifecycle lifecycle,
      ObjectMapper jsonMapper) {
    final HttpClientConfig.Builder builder =
        HttpClientConfig.builder()
            .withNumConnections(1)
            .withReadTimeout(config.get().getReadTimeout().toStandardDuration());

    if (sslContext != null) {
      builder.withSslContext(sslContext);
    }

    return new HttpPostEmitter(
        config.get(), HttpClientInit.createClient(builder.build(), lifecycle), jsonMapper);
  }