Skip to content

Commit

Permalink
[LI-HOTFIX] Add backward compatible constructor for KafkaServer (#492)
Browse files Browse the repository at this point in the history
This pr adds back the 2.4 kafka compatible constructor for KafkaServer.

LI_DESCRIPTION =
In mario testing, we are using reflection to create scala KafkaServer classes in EmbeddedBroker where it's using the KafkaServer constructor in 2.4 with 4 params.

While moving to kafka 3.0, this constructor is removed and the new constructor (including deprecated one) requires a trait class KafkaActions, which is used to hook up with cruise control and doesn't have any implementation in kafka itself, making it impossible for mario/other library to construct it using reflection (requires concrete class).

EXIT_CRITERIA = We can deprecate this pr when either oss kafka provides concrete implementation for KafkaActions class or mario has found alternative ways of creating KafkaServer for integration testing.
  • Loading branch information
kehuum authored Nov 2, 2023
1 parent ea526ac commit e1e2830
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/scala/kafka/server/KafkaServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ class KafkaServer(
this(config, time, threadNamePrefix, enableForwarding = false, actions = actions)
}

// Visible for testing from mario for backwards compatibility.
@deprecated
def this(
config: KafkaConfig,
time: Time,
threadNamePrefix: Option[String],
kafkaMetricsReporters: Seq[KafkaMetricsReporter]) {
this(config, time, threadNamePrefix, enableForwarding = false, actions = NoOpKafkaActions)
}

private val startupComplete = new AtomicBoolean(false)
private val isShuttingDown = new AtomicBoolean(false)
private val isStartingUp = new AtomicBoolean(false)
Expand Down

0 comments on commit e1e2830

Please sign in to comment.