Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-14247: add handler impl to the prototype #12775

Merged
merged 8 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,6 @@ public class DefaultBackgroundThread extends KafkaThread {
private final AtomicReference<Optional<RuntimeException>> exception =
new AtomicReference<>(Optional.empty());

public DefaultBackgroundThread(final ConsumerConfig config,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing unused constructor for now.

final LogContext logContext,
final BlockingQueue<ApplicationEvent> applicationEventQueue,
final BlockingQueue<BackgroundEvent> backgroundEventQueue,
final SubscriptionState subscriptions,
final ConsumerMetadata metadata,
final ConsumerNetworkClient networkClient,
final Metrics metrics) {
this(
Time.SYSTEM,
config,
logContext,
applicationEventQueue,
backgroundEventQueue,
subscriptions,
metadata,
networkClient,
metrics
);
}

public DefaultBackgroundThread(final Time time,
final ConsumerConfig config,
final LogContext logContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.List;
import java.util.Optional;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
* An {@code EventHandler} that uses a single background thread to consume {@code ApplicationEvent} and produce
Expand All @@ -46,6 +47,24 @@ public class DefaultEventHandler implements EventHandler {
private final BlockingQueue<BackgroundEvent> backgroundEventQueue;
private final DefaultBackgroundThread backgroundThread;

public DefaultEventHandler(final ConsumerConfig config,
final LogContext logContext,
final SubscriptionState subscriptionState,
final ApiVersions apiVersions,
final Metrics metrics,
final ClusterResourceListeners clusterResourceListeners,
final Sensor fetcherThrottleTimeSensor) {
this(Time.SYSTEM,
config,
logContext,
new LinkedBlockingQueue<>(),
new LinkedBlockingQueue<>(),
subscriptionState,
apiVersions,
metrics,
clusterResourceListeners,
fetcherThrottleTimeSensor);
}

public DefaultEventHandler(final Time time,
final ConsumerConfig config,
Expand Down Expand Up @@ -95,14 +114,13 @@ public DefaultEventHandler(final Time time,
logContext
);
final ConsumerNetworkClient networkClient = new ConsumerNetworkClient(
logContext,
netClient,
metadata,
time,
config.getInt(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG),
config.getInt(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG),
config.getInt(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG)
);
logContext,
netClient,
metadata,
time,
config.getLong(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG),
config.getInt(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG),
config.getInt(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG));
this.backgroundThread = new DefaultBackgroundThread(
time,
config,
Expand Down
Loading