Skip to content
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
20 changes: 12 additions & 8 deletions core/src/main/scala/kafka/server/BrokerServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,7 @@ class BrokerServer(
sharedServer.metadataLoaderFaultHandler)

// AutoMQ for Kafka inject start

if (config.elasticStreamEnabled) {
if (!ElasticLogManager.init(config, clusterId, this)) {
throw new UnsupportedOperationException("Elastic stream client failed to be configured. Please check your configuration.")
}
} else {
warn("Elastic stream is disabled. This node will store data locally.")
}
initElasticLogManager()
// AutoMQ for Kafka inject end

val networkListeners = new ListenerCollection()
Expand Down Expand Up @@ -656,4 +649,15 @@ class BrokerServer(
retryTimeout
)
}

protected def initElasticLogManager(): Unit = {
if (config.elasticStreamEnabled) {
if (!ElasticLogManager.init(config, clusterId, this)) {
throw new UnsupportedOperationException("Elastic stream client failed to be configured. Please check your configuration.")
}
} else {
warn("Elastic stream is disabled. This node will store data locally.")
}
}

}
29 changes: 20 additions & 9 deletions core/src/main/scala/kafka/server/KafkaRaftServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,13 @@ class KafkaRaftServer(
)

private val broker: Option[BrokerServer] = if (config.processRoles.contains(BrokerRole)) {
Some(new BrokerServer(
sharedServer,
offlineDirs
))
Some(brokerServer())
} else {
None
}

private val controller: Option[ControllerServer] = if (config.processRoles.contains(ControllerRole)) {
Some(new ControllerServer(
sharedServer,
KafkaRaftServer.configSchema,
bootstrapMetadata,
))
Some(controllerServer())
} else {
None
}
Expand All @@ -114,6 +107,24 @@ class KafkaRaftServer(
broker.foreach(_.awaitShutdown())
controller.foreach(_.awaitShutdown())
}

// AutoMQ for Kafka inject start
protected def brokerServer(): BrokerServer = {
new BrokerServer(
sharedServer,
offlineDirs
)
}

protected def controllerServer(): ControllerServer = {
new ControllerServer(
sharedServer,
KafkaRaftServer.configSchema,
bootstrapMetadata,
)
}
// AutoMQ for Kafka inject end

}

object KafkaRaftServer {
Expand Down