Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Import Process
group-reports-consumer
Commits
409cdf6d
Commit
409cdf6d
authored
Jun 10, 2021
by
Jonas Waeber
Browse files
Add additional logging!
parent
4a5e73b4
Pipeline
#27692
passed with stages
in 3 minutes and 28 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/Service.kt
View file @
409cdf6d
...
@@ -47,6 +47,9 @@ class Service(file: String = "app.yml") {
...
@@ -47,6 +47,9 @@ class Service(file: String = "app.yml") {
val
collector
=
ReportCollector
(
importApiUrl
)
val
collector
=
ReportCollector
(
importApiUrl
)
fun
run
()
{
fun
run
()
{
log
.
info
(
"Begin reading from topic ${settings.inputTopic} on kafka cluster."
)
log
.
info
(
"Sending aggregated reports to ${importApiUrl}."
)
log
.
info
(
"Reading the following steps: ${stepWhitelist.str()}"
)
while
(
true
)
{
while
(
true
)
{
consumer
.
consume
()
consumer
.
consume
()
.
mapNotNull
{
klaxon
.
parse
<
IndexReport
>(
it
.
value
())
}
.
mapNotNull
{
klaxon
.
parse
<
IndexReport
>(
it
.
value
())
}
...
...
src/main/kotlin/StepWhitelist.kt
View file @
409cdf6d
package
org.memobase
package
org.memobase
import
org.apache.logging.log4j.LogManager
import
java.io.File
import
java.io.File
import
java.nio.charset.Charset
import
java.nio.charset.Charset
class
StepWhitelist
(
path
:
String
)
{
class
StepWhitelist
(
path
:
String
)
{
private
val
log
=
LogManager
.
getLogger
(
this
::
class
.
java
)
private
val
whitelist
=
File
(
path
).
readLines
(
Charset
.
defaultCharset
())
private
val
whitelist
=
File
(
path
).
readLines
(
Charset
.
defaultCharset
())
fun
check
(
step
:
String
):
Boolean
{
fun
check
(
step
:
String
):
Boolean
{
return
whitelist
.
contains
(
step
)
return
if
(
whitelist
.
contains
(
step
))
{
log
.
info
(
"Step $step is present in whitelist. Processing report."
)
true
}
else
{
log
.
info
(
"Step $step is not present in whitelist. Not processing."
)
false
}
}
fun
str
():
String
{
return
whitelist
.
joinToString
(
", "
)
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment