Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
Mapper Service
Commits
e301fff0
Commit
e301fff0
authored
Feb 11, 2021
by
Jonas Waeber
Browse files
Improve reporting
Update dependency.
parent
cb4d5746
Pipeline
#21600
passed with stages
in 4 minutes and 2 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
build.gradle
View file @
e301fff0
...
...
@@ -33,7 +33,7 @@ ext {
dependencies
{
implementation
'ch.memobase:memobase-kafka-utils:0.2.3'
implementation
'org.memobase:memobase-service-utilities:2.0.5'
implementation
'ch.memobase:mapper-service-configuration:1.0.
2
'
implementation
'ch.memobase:mapper-service-configuration:1.0.
3
'
// Logging Framework
implementation
"org.apache.logging.log4j:log4j-api:${log4jV}"
implementation
"org.apache.logging.log4j:log4j-core:${log4jV}"
...
...
src/main/kotlin/KafkaTopology.kt
View file @
e301fff0
...
...
@@ -45,7 +45,7 @@ class KafkaTopology(
private
val
settings
:
SettingsLoader
)
{
private
val
log
=
LogManager
.
getLogger
(
"
KafkaTopology
"
)
private
val
log
=
LogManager
.
getLogger
(
"
MappingProcessor
"
)
private
val
reportTopic
=
settings
.
processReportTopic
private
val
klaxon
=
Klaxon
()
...
...
@@ -75,7 +75,7 @@ class KafkaTopology(
configJoiner
.
join
(
stream
,
configStream
)
val
handledStream
=
joinedStream
.
mapValues
{
readOnlyKey
,
value
->
handleExceptions
(
value
)
}
.
mapValues
{
value
->
handleExceptions
(
value
)
}
.
branch
(
Predicate
{
_
,
value
->
value
.
third
!=
""
},
Predicate
{
_
,
_
->
true
}
...
...
@@ -173,7 +173,7 @@ class KafkaTopology(
val
noRecordId
=
hasRecordId
[
1
]
noRecordId
.
mapValues
{
key
,
_
->
Report
(
key
,
ReportStatus
.
fatal
,
"No record id found for record $key."
,
Service
.
step
).
toJson
()
}
.
mapValues
{
key
,
value
->
Report
(
key
,
ReportStatus
.
fatal
,
value
.
errorMessage
,
Service
.
step
).
toJson
()
}
.
to
(
reportTopic
)
return
hasRecordId
[
0
]
...
...
@@ -190,11 +190,11 @@ class KafkaTopology(
val
noRecordTypeValue
=
hasRecordTypeValue
[
1
]
noRecordTypeValue
.
mapValues
{
key
,
_
->
.
mapValues
{
key
,
value
->
Report
(
key
,
ReportStatus
.
fatal
,
"No correct record type found for record $key."
,
value
.
errorMessage
,
Service
.
step
).
toJson
()
}
...
...
@@ -209,7 +209,7 @@ class KafkaTopology(
result
.
first
,
Pair
(
result
.
second
,
Report
(
result
.
first
,
ReportStatus
.
success
,
"
Successfully mapped record with id ${result.first}.
"
,
Service
.
step
)
Report
(
result
.
first
,
ReportStatus
.
success
,
""
,
Service
.
step
)
)
)
}
...
...
@@ -230,7 +230,7 @@ class KafkaTopology(
Triple
(
parsedSource
,
mapperConfiguration
.
get
(),
null
)
}
else
{
log
.
error
(
"Parsed source is empty: ${value.first}."
)
Triple
(
null
,
null
,
Report
(
key
,
ReportStatus
.
fatal
,
"
F
ou
n
d
empty
source document."
,
Service
.
step
))
Triple
(
null
,
null
,
Report
(
key
,
ReportStatus
.
fatal
,
"
C
ou
l
d
not parse
source document."
,
Service
.
step
))
}
}
catch
(
ex
:
InvalidMappingException
)
{
log
.
error
(
ex
.
localizedMessage
)
...
...
src/test/kotlin/IntegrationTests.kt
View file @
e301fff0
...
...
@@ -195,7 +195,7 @@ class IntegrationTests {
Report
(
"https://memobase.ch/record/test-record-set-id-ID_1"
,
"SUCCESS"
,
"
Successfully mapped record with id https://memobase.ch/record/test-record-set-id-ID_1.
"
,
""
,
Service
.
step
)
)
/*,
...
...
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