Search in sources :

Example 6 with ConsumerNetworkClient

use of org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient in project kafka by apache.

the class WorkerCoordinatorIncrementalTest method setup.

@Before
public void setup() {
    LogContext loggerFactory = new LogContext();
    this.time = new MockTime();
    this.metadata = new Metadata(0, Long.MAX_VALUE, loggerFactory, new ClusterResourceListeners());
    this.client = new MockClient(time, metadata);
    this.client.updateMetadata(RequestTestUtils.metadataUpdateWith(1, Collections.singletonMap("topic", 1)));
    this.node = metadata.fetch().nodes().get(0);
    this.consumerClient = new ConsumerNetworkClient(loggerFactory, client, metadata, time, retryBackoffMs, requestTimeoutMs, heartbeatIntervalMs);
    this.metrics = new Metrics(time);
    this.rebalanceListener = new MockRebalanceListener();
    this.leaderId = "worker1";
    this.memberId = "worker2";
    this.anotherMemberId = "worker3";
    this.leaderUrl = expectedUrl(leaderId);
    this.memberUrl = expectedUrl(memberId);
    this.anotherMemberUrl = expectedUrl(anotherMemberId);
    this.generationId = 3;
    this.offset = 10L;
    this.configStorageCalls = 0;
    this.rebalanceConfig = new GroupRebalanceConfig(sessionTimeoutMs, rebalanceTimeoutMs, heartbeatIntervalMs, groupId, Optional.empty(), retryBackoffMs, true);
    this.coordinator = new WorkerCoordinator(rebalanceConfig, loggerFactory, consumerClient, metrics, "worker" + groupId, time, expectedUrl(leaderId), configStorage, rebalanceListener, compatibility, rebalanceDelay);
    configState1 = clusterConfigState(offset, 2, 4);
}
Also used : GroupRebalanceConfig(org.apache.kafka.clients.GroupRebalanceConfig) ClusterResourceListeners(org.apache.kafka.common.internals.ClusterResourceListeners) Metrics(org.apache.kafka.common.metrics.Metrics) ConsumerNetworkClient(org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient) Metadata(org.apache.kafka.clients.Metadata) LogContext(org.apache.kafka.common.utils.LogContext) MockTime(org.apache.kafka.common.utils.MockTime) MockClient(org.apache.kafka.clients.MockClient) Before(org.junit.Before)

Aggregations

ConsumerNetworkClient (org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient)6 Metrics (org.apache.kafka.common.metrics.Metrics)6 LogContext (org.apache.kafka.common.utils.LogContext)5 GroupRebalanceConfig (org.apache.kafka.clients.GroupRebalanceConfig)3 Metadata (org.apache.kafka.clients.Metadata)3 MockClient (org.apache.kafka.clients.MockClient)3 ConsumerCoordinator (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)3 Fetcher (org.apache.kafka.clients.consumer.internals.Fetcher)3 StringDeserializer (org.apache.kafka.common.serialization.StringDeserializer)3 MockTime (org.apache.kafka.common.utils.MockTime)3 Before (org.junit.Before)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConsumerInterceptors (org.apache.kafka.clients.consumer.internals.ConsumerInterceptors)2 ConsumerMetrics (org.apache.kafka.clients.consumer.internals.ConsumerMetrics)2 PartitionAssignor (org.apache.kafka.clients.consumer.internals.PartitionAssignor)2 SubscriptionState (org.apache.kafka.clients.consumer.internals.SubscriptionState)2 ClusterResourceListeners (org.apache.kafka.common.internals.ClusterResourceListeners)2 TargetState (org.apache.kafka.connect.runtime.TargetState)2 KafkaConfigBackingStore (org.apache.kafka.connect.storage.KafkaConfigBackingStore)2