Search in sources :

Example 1 with Builder

use of io.confluent.ksql.rest.server.HeartbeatAgent.Builder in project ksql by confluentinc.

the class HeartbeatAgentTest method setUp.

@Before
public void setUp() {
    localHostInfo = new HostInfo("localhost", 8088);
    remoteHostInfo = new HostInfo("localhost", 8089);
    localHost = new KsqlHostInfo("localhost", 8088);
    remoteHost = new KsqlHostInfo("localhost", 8089);
    Builder builder = HeartbeatAgent.builder();
    heartbeatAgent = builder.heartbeatSendInterval(1).heartbeatMissedThreshold(2).addHostStatusListener(hostStatusListener).build(ksqlEngine, serviceContext);
    heartbeatAgent.setLocalAddress(LOCALHOST_URL);
    hostsStatus = ImmutableMap.of(localHost, new HostStatus(true, 0L), remoteHost, new HostStatus(true, 0L));
    allMetadata0 = ImmutableList.of(streamsMetadata0);
    allMetadata1 = ImmutableList.of(streamsMetadata1);
}
Also used : KsqlHostInfo(io.confluent.ksql.util.KsqlHostInfo) Builder(io.confluent.ksql.rest.server.HeartbeatAgent.Builder) HostStatus(io.confluent.ksql.util.HostStatus) HostInfo(org.apache.kafka.streams.state.HostInfo) KsqlHostInfo(io.confluent.ksql.util.KsqlHostInfo) Before(org.junit.Before)

Example 2 with Builder

use of io.confluent.ksql.rest.server.HeartbeatAgent.Builder in project ksql by confluentinc.

the class KsqlRestApplication method initializeHeartbeatAgent.

private static Optional<HeartbeatAgent> initializeHeartbeatAgent(final KsqlRestConfig restConfig, final KsqlEngine ksqlEngine, final ServiceContext serviceContext, final Optional<LagReportingAgent> lagReportingAgent) {
    if (restConfig.getBoolean(KsqlRestConfig.KSQL_HEARTBEAT_ENABLE_CONFIG)) {
        final Builder builder = HeartbeatAgent.builder();
        builder.heartbeatSendInterval(restConfig.getLong(KsqlRestConfig.KSQL_HEARTBEAT_SEND_INTERVAL_MS_CONFIG)).heartbeatCheckInterval(restConfig.getLong(KsqlRestConfig.KSQL_HEARTBEAT_CHECK_INTERVAL_MS_CONFIG)).heartbeatMissedThreshold(restConfig.getLong(KsqlRestConfig.KSQL_HEARTBEAT_MISSED_THRESHOLD_CONFIG)).heartbeatWindow(restConfig.getLong(KsqlRestConfig.KSQL_HEARTBEAT_WINDOW_MS_CONFIG)).discoverClusterInterval(restConfig.getLong(KsqlRestConfig.KSQL_HEARTBEAT_DISCOVER_CLUSTER_MS_CONFIG)).threadPoolSize(restConfig.getInt(KsqlRestConfig.KSQL_HEARTBEAT_THREAD_POOL_SIZE_CONFIG));
        lagReportingAgent.ifPresent(builder::addHostStatusListener);
        return Optional.of(builder.build(ksqlEngine, serviceContext));
    }
    return Optional.empty();
}
Also used : Builder(io.confluent.ksql.rest.server.HeartbeatAgent.Builder) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder)

Aggregations

Builder (io.confluent.ksql.rest.server.HeartbeatAgent.Builder)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 HostStatus (io.confluent.ksql.util.HostStatus)1 KsqlHostInfo (io.confluent.ksql.util.KsqlHostInfo)1 HostInfo (org.apache.kafka.streams.state.HostInfo)1 Before (org.junit.Before)1