Skip to content

Commit

Permalink
feat: include the Zeebe version in the topology
Browse files Browse the repository at this point in the history
The gRPC topology response contains the version of the broker and gateway. Adjust the versions to contains not only the version of EZE but also the version of Zeebe.
  • Loading branch information
saig0 committed Feb 21, 2023
1 parent 8315b10 commit c675275
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class GrpcToLogStreamGateway(

private val requestIdGenerator = AtomicLong()

private val versionInfo = getVersionInfo()

private fun writeCommandWithKey(
key: Long,
metadata: RecordMetadata,
Expand Down Expand Up @@ -426,7 +428,7 @@ class GrpcToLogStreamGateway(
.addPartitions(partition)
.setHost("0.0.0.0")
.setPort(26500)
.setVersion(javaClass.`package`.implementationVersion ?: "X.Y.Z")
.setVersion(versionInfo)
.build()

val topologyResponse = GatewayOuterClass.TopologyResponse
Expand All @@ -435,7 +437,7 @@ class GrpcToLogStreamGateway(
.setClusterSize(1)
.setPartitionsCount(1)
.setReplicationFactor(1)
.setGatewayVersion(javaClass.`package`.implementationVersion ?: "A.B.C")
.setGatewayVersion(versionInfo)
.build()

responseObserver.onNext(topologyResponse)
Expand Down Expand Up @@ -493,4 +495,11 @@ class GrpcToLogStreamGateway(
// TODO handle
}
}

private fun getVersionInfo(): String {
val ezeVersion = javaClass.`package`.implementationVersion ?: "dev"
val zeebeVersion = RecordMetadata::class.java.`package`.implementationVersion ?: "dev"

return "$ezeVersion ($zeebeVersion)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ class EngineClientTest {
assertThat(topology.clusterSize).isEqualTo(1)
assertThat(topology.replicationFactor).isEqualTo(1)
assertThat(topology.partitionsCount).isEqualTo(1)
assertThat(topology.gatewayVersion).isEqualTo("A.B.C")
assertThat(topology.gatewayVersion)
.describedAs("Expect a version with the pattern 'dev (8.1.8)'")
.containsPattern("""dev \(8\.\d+\.\d+\)""")

assertThat(topology.brokers).hasSize(1)
val broker = topology.brokers[0]
assertThat(broker.host).isEqualTo("0.0.0.0")
assertThat(broker.port).isEqualTo(26500)
assertThat(broker.version).isEqualTo("X.Y.Z")
assertThat(broker.version)
.describedAs("Expect a version with the pattern 'dev (8.1.8)'")
.containsPattern("""dev \(8\.\d+\.\d+\)""")

assertThat(broker.partitions).hasSize(1)
val partition = broker.partitions[0]
Expand Down

0 comments on commit c675275

Please sign in to comment.