Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
c0877a5e
Commit
c0877a5e
authored
3 years ago
by
Sören Henning
Browse files
Options
Downloads
Patches
Plain Diff
Minor code style fixes
parent
50fcca86
No related branches found
No related tags found
3 merge requests
!159
Re-implementation of Theodolite with Kotlin/Quarkus
,
!157
Update Graal Image in CI pipeline
,
!83
WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theodolite-quarkus/build.gradle
+3
-3
3 additions, 3 deletions
theodolite-quarkus/build.gradle
theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt
+9
-8
9 additions, 8 deletions
...te-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt
with
12 additions
and
11 deletions
theodolite-quarkus/build.gradle
+
3
−
3
View file @
c0877a5e
...
@@ -18,16 +18,16 @@ dependencies {
...
@@ -18,16 +18,16 @@ dependencies {
implementation
'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation
'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation
'io.quarkus:quarkus-arc'
implementation
'io.quarkus:quarkus-arc'
implementation
'io.quarkus:quarkus-resteasy'
implementation
'io.quarkus:quarkus-resteasy'
testImplementation
'io.quarkus:quarkus-junit5'
testImplementation
'io.rest-assured:rest-assured'
implementation
'com.google.code.gson:gson:2.8.5'
implementation
'com.google.code.gson:gson:2.8.5'
implementation
'org.slf4j:slf4j-simple:1.7.29'
implementation
'org.slf4j:slf4j-simple:1.7.29'
implementation
'io.github.microutils:kotlin-logging:1.12.0'
implementation
'io.github.microutils:kotlin-logging:1.12.0'
implementation
'io.fabric8:kubernetes-client:5.0.0-alpha-2'
implementation
'io.fabric8:kubernetes-client:5.0.0-alpha-2'
implementation
'io.quarkus:quarkus-kubernetes-client'
implementation
'io.quarkus:quarkus-kubernetes-client'
implementation
'org.apache.kafka:kafka-clients:2.7.0'
implementation
'org.apache.kafka:kafka-clients:2.7.0'
implementation
'khttp:khttp:1.0.0'
implementation
'khttp:khttp:1.0.0'
testImplementation
'io.quarkus:quarkus-junit5'
testImplementation
'io.rest-assured:rest-assured'
}
}
group
'theodolite'
group
'theodolite'
...
...
This diff is collapsed.
Click to expand it.
theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt
+
9
−
8
View file @
c0877a5e
...
@@ -11,13 +11,14 @@ private const val RETRY_TIME = 2000L
...
@@ -11,13 +11,14 @@ private const val RETRY_TIME = 2000L
/**
/**
* Manages the topics related tasks
* Manages the topics related tasks
* @param kafkaConfig Kafka
C
onfiguration as
Hash
Map
* @param kafkaConfig Kafka
c
onfiguration as
a
Map
* @constructor Creates a KafkaAdminClient
* @constructor Creates a KafkaAdminClient
*/
*/
class
TopicManager
(
private
val
kafkaConfig
:
HashMap
<
String
,
Any
>)
{
class
TopicManager
(
private
val
kafkaConfig
:
Map
<
String
,
Any
>)
{
/**
/**
* Create
s
topics.
* Create topics.
* @param newTopics
List
of all
T
opic that should be created
* @param newTopics
Collection
of all
t
opic that should be created
*/
*/
fun
createTopics
(
newTopics
:
Collection
<
NewTopic
>)
{
fun
createTopics
(
newTopics
:
Collection
<
NewTopic
>)
{
val
kafkaAdmin
:
AdminClient
=
AdminClient
.
create
(
this
.
kafkaConfig
)
val
kafkaAdmin
:
AdminClient
=
AdminClient
.
create
(
this
.
kafkaConfig
)
...
@@ -27,7 +28,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
...
@@ -27,7 +28,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
var
retryCreation
=
false
var
retryCreation
=
false
try
{
try
{
result
=
kafkaAdmin
.
createTopics
(
newTopics
)
result
=
kafkaAdmin
.
createTopics
(
newTopics
)
result
.
all
().
get
()
// wait for the future
object
result
.
all
().
get
()
// wait for the future
to be completed
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
delete
(
newTopics
.
map
{
topic
->
topic
.
name
()
},
kafkaAdmin
)
delete
(
newTopics
.
map
{
topic
->
topic
.
name
()
},
kafkaAdmin
)
...
@@ -49,8 +50,8 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
...
@@ -49,8 +50,8 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
}
}
/**
/**
* Remove
s
topics.
* Remove topics.
* @param topics
List
of names
with
the topics to remove.
* @param topics
Collection
of names
for
the topics to remove.
*/
*/
fun
removeTopics
(
topics
:
List
<
String
>)
{
fun
removeTopics
(
topics
:
List
<
String
>)
{
val
kafkaAdmin
:
AdminClient
=
AdminClient
.
create
(
this
.
kafkaConfig
)
val
kafkaAdmin
:
AdminClient
=
AdminClient
.
create
(
this
.
kafkaConfig
)
...
@@ -64,7 +65,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
...
@@ -64,7 +65,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
while
(!
deleted
)
{
while
(!
deleted
)
{
try
{
try
{
val
result
=
kafkaAdmin
.
deleteTopics
(
topics
)
val
result
=
kafkaAdmin
.
deleteTopics
(
topics
)
result
.
all
().
get
()
// wait for the future
object
result
.
all
().
get
()
// wait for the future
to be completed
logger
.
info
{
logger
.
info
{
"Topics deletion finished with result: ${
"Topics deletion finished with result: ${
result
.
values
().
map
{
it
->
it
.
key
+
": "
+
it
.
value
.
isDone
}
result
.
values
().
map
{
it
->
it
.
key
+
": "
+
it
.
value
.
isDone
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment