Skip to content

Commit 5446a78

Browse files
committed
Sort topics in consumer view
This will sort the list of topics a consumer is assigned to.
1 parent 2b3ca92 commit 5446a78

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

app/kafka/manager/model/ActorModel.scala

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import scala.collection.immutable.Queue
1919
import scala.util.Try
2020
import scalaz.{NonEmptyList, Validation}
2121

22+
import scala.collection.immutable.SortedMap
2223
import scala.collection.immutable.Map
2324

2425
/**
@@ -101,8 +102,8 @@ object ActorModel {
101102
log_path: String,
102103
config: Properties = new Properties
103104
) extends CommandRequest
104-
case class CMUpdateLogkafkaConfig(logkafka_id: String,
105-
log_path: String,
105+
case class CMUpdateLogkafkaConfig(logkafka_id: String,
106+
log_path: String,
106107
config: Properties,
107108
checkConfig: Boolean = true
108109
) extends CommandRequest
@@ -200,22 +201,22 @@ object ActorModel {
200201

201202
case class TopicDescription(topic: String,
202203
description: (Int,String),
203-
partitionState: Option[Map[String, String]],
204+
partitionState: Option[Map[String, String]],
204205
partitionOffsets: PartitionOffsetsCapture,
205206
config:Option[(Int,String)]) extends QueryResponse
206207
case class TopicDescriptions(descriptions: IndexedSeq[TopicDescription], lastUpdateMillis: Long) extends QueryResponse
207208

208209
case class BrokerList(list: IndexedSeq[BrokerIdentity], clusterContext: ClusterContext) extends QueryResponse
209210

210-
case class PreferredReplicaElection(startTime: DateTime,
211+
case class PreferredReplicaElection(startTime: DateTime,
211212
topicAndPartition: Set[TopicPartition],
212-
endTime: Option[DateTime],
213+
endTime: Option[DateTime],
213214
clusterContext: ClusterContext) extends QueryResponse {
214215
def sortedTopicPartitionList: List[(String, Int)] = topicAndPartition.toList.map(tp => (tp.topic(), tp.partition())).sortBy(_._1)
215216
}
216-
case class ReassignPartitions(startTime: DateTime,
217+
case class ReassignPartitions(startTime: DateTime,
217218
partitionsToBeReassigned: Map[TopicPartition, Seq[Int]],
218-
endTime: Option[DateTime],
219+
endTime: Option[DateTime],
219220
clusterContext: ClusterContext) extends QueryResponse {
220221
def sortedTopicPartitionAssignmentList : List[((String, Int), Seq[Int])] = partitionsToBeReassigned.toList.sortBy(partition => (partition._1.topic(), partition._1.partition())).map { case (tp, a) => ((tp.topic(), tp.partition()), a)}
221222
}
@@ -371,7 +372,7 @@ import scala.language.reflectiveCalls
371372

372373
object PartitionOffsetsCapture {
373374
val ZERO : Option[Double] = Option(0D)
374-
375+
375376
val EMPTY : PartitionOffsetsCapture = PartitionOffsetsCapture(0, Map.empty)
376377

377378
def getRate(part: Int, currentOffsets: PartitionOffsetsCapture, previousOffsets: PartitionOffsetsCapture): Option[Double] = {
@@ -656,7 +657,7 @@ import scala.language.reflectiveCalls
656657

657658
case class ConsumerIdentity(consumerGroup:String,
658659
consumerType: ConsumerType,
659-
topicMap: Map[String, ConsumedTopicState],
660+
topicMap: collection.Map[String, ConsumedTopicState],
660661
clusterContext: ClusterContext)
661662
object ConsumerIdentity extends Logging {
662663
import scala.language.reflectiveCalls
@@ -669,7 +670,7 @@ import scala.language.reflectiveCalls
669670
} yield (topic, cts)
670671
ConsumerIdentity(cd.consumer,
671672
cd.consumerType,
672-
topicMap.toMap,
673+
SortedMap(topicMap: _*),
673674
clusterContext)
674675
}
675676

@@ -713,7 +714,7 @@ import scala.language.reflectiveCalls
713714
}
714715

715716
case class BrokerClusterStats(perMessages: BigDecimal, perIncoming: BigDecimal, perOutgoing: BigDecimal)
716-
717+
717718
sealed trait LKVRequest extends QueryRequest
718719

719720
case object LKVForceUpdate extends CommandRequest

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ logLevel := Level.Info
77

88
resolvers += Resolver.url(
99
"bintray-sbt-plugin-releases",
10-
url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))(
10+
url("https://dl.bintray.com/content/sbt/sbt-plugin-releases"))(
1111
Resolver.ivyStylePatterns)
1212

1313
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
1414

1515
// The Typesafe repository
16-
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
16+
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
1717

1818
// Use the Play sbt plugin for Play projects
1919
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.21")

0 commit comments

Comments
 (0)