Commit eeb52aab authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add reporting step value

parent 35d0b44a
Pipeline #31572 passed with stages
in 5 minutes and 21 seconds
...@@ -8,3 +8,4 @@ data: ...@@ -8,3 +8,4 @@ data:
TOPIC_IN: "{{ .Values.inputTopicName }}" TOPIC_IN: "{{ .Values.inputTopicName }}"
TOPIC_OUT: "{{ .Values.outputTopicName }}" TOPIC_OUT: "{{ .Values.outputTopicName }}"
TOPIC_PROCESS: "{{ .Values.reportingTopicName }}" TOPIC_PROCESS: "{{ .Values.reportingTopicName }}"
REPORTING_STEP_NAME: "{{ .Values.reportingStepName }}"
...@@ -18,4 +18,6 @@ inputTopicName: placeholder ...@@ -18,4 +18,6 @@ inputTopicName: placeholder
outputTopicName: placeholder outputTopicName: placeholder
reportingTopicName: placeholder reportingTopicName: placeholder
applicationId: placeholder applicationId: placeholder
groupId: placeholder groupId: placeholder
\ No newline at end of file
reportingStepName: 09.02-iiif-manifest-creator
\ No newline at end of file
app:
reportingStepName: ${REPORTING_STEP_NAME:?system}
kafka: kafka:
streams: streams:
bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:?system} bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:?system}
......
...@@ -28,16 +28,17 @@ import scala.collection.JavaConverters._ ...@@ -28,16 +28,17 @@ import scala.collection.JavaConverters._
import scala.util.{Failure, Success, Try} import scala.util.{Failure, Success, Try}
object App extends scala.App with Logging { object App extends scala.App with Logging {
val reportingStepNameProp = "reportingStepName"
val topology = new KafkaTopology
private val settings = new SettingsLoader( private val settings = new SettingsLoader(
List[String]().asJava, List[String](reportingStepNameProp).asJava,
"app.yml", "app.yml",
false, false,
true, true,
false, false,
false false
) )
val topology = new KafkaTopology(settings.getAppSettings.getProperty(reportingStepNameProp))
val streams = new KafkaStreams( val streams = new KafkaStreams(
topology.build( topology.build(
......
...@@ -26,7 +26,7 @@ import org.apache.logging.log4j.scala.Logging ...@@ -26,7 +26,7 @@ import org.apache.logging.log4j.scala.Logging
import scala.util.Try import scala.util.Try
class KafkaTopology extends Logging { class KafkaTopology(private val step: String) extends Logging {
import KafkaTopologyUtils._ import KafkaTopologyUtils._
import Serdes._ import Serdes._
...@@ -98,7 +98,8 @@ class KafkaTopology extends Logging { ...@@ -98,7 +98,8 @@ class KafkaTopology extends Logging {
ReportingObject( ReportingObject(
k, k,
ProcessingWarning, ProcessingWarning,
v.get.warnings.mkString("\n") v.get.warnings.mkString("\n"),
step
).toString ).toString
) )
) )
...@@ -115,7 +116,8 @@ class KafkaTopology extends Logging { ...@@ -115,7 +116,8 @@ class KafkaTopology extends Logging {
ReportingObject( ReportingObject(
k, k,
ProcessingSuccess, ProcessingSuccess,
"IIIF manifest successfully created" "IIIF manifest successfully created",
step
).toString ).toString
) )
) )
...@@ -132,7 +134,8 @@ class KafkaTopology extends Logging { ...@@ -132,7 +134,8 @@ class KafkaTopology extends Logging {
ReportingObject( ReportingObject(
k, k,
ProcessingFatal, ProcessingFatal,
s"Error creating manifest: ${v.failed.get.getMessage}" s"Error creating manifest: ${v.failed.get.getMessage}",
step
).toString ).toString
) )
) )
...@@ -150,7 +153,8 @@ class KafkaTopology extends Logging { ...@@ -150,7 +153,8 @@ class KafkaTopology extends Logging {
ReportingObject( ReportingObject(
k, k,
ProcessingIgnore, ProcessingIgnore,
message message,
step
).toString ).toString
) )
) )
......
...@@ -46,12 +46,13 @@ case object ProcessingFatal extends ProcessingStatus { ...@@ -46,12 +46,13 @@ case object ProcessingFatal extends ProcessingStatus {
case class ReportingObject( case class ReportingObject(
id: String, id: String,
status: ProcessingStatus, status: ProcessingStatus,
message: String message: String,
step: String
) { ) {
override def toString: String = override def toString: String =
ujson.write( ujson.write(
ujson.Obj( ujson.Obj(
("step", "iiif-manifest-creator"), ("step", step),
("timestamp", createTimestamp), ("timestamp", createTimestamp),
("id", id), ("id", id),
("status", status.value), ("status", status.value),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment