Unverified Commit 8343c7e0 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

send locatorless records downstream

parent bb99bf90
Pipeline #17266 failed with stages
in 5 minutes and 39 seconds
......@@ -43,6 +43,11 @@ class KafkaTopology extends Logging {
recordWithLocator
)
sendRecordsDownstream(
locatorlessRecord,
SettingsFromFile.outputTopicIgnore
)
sendRecordsDownstream(
unenrichableRecord,
SettingsFromFile.outputTopicIgnore
......@@ -150,8 +155,8 @@ class KafkaTopology extends Logging {
k,
ReportingObject(
k,
ProcessingFailure,
"Record has no locator! Can't decide on player type."
ProcessingWarning,
"Record has no locator. Is this intentional (i.e. media file is not accessible)?"
).toString
)
)
......
......@@ -122,7 +122,7 @@ object KafkaTopologyUtils extends Logging {
getMemobasePlayerType(recordType)
case Failure(_) =>
logger.warn(
s"Couldn't identify apex domain of url $mediaUrl. Setting player type to default default default default default default default default default MemobasePlayer"
s"Couldn't identify apex domain of url $mediaUrl. Setting player type to default MemobasePlayer"
)
getMemobasePlayerType(recordType)
}
......
......@@ -24,29 +24,44 @@ import java.util.Calendar
import ch.memobase.models.ReportingObject.{createTimestamp, escapeApostrophes}
sealed trait ProcessingStatus
case object ProcessingSuccess extends ProcessingStatus
case object ProcessingFailure extends ProcessingStatus
sealed trait ProcessingStatus {
val value: String
}
case object ProcessingSuccess extends ProcessingStatus {
override val value: String = "SUCCESS"
}
case object ProcessingWarning extends ProcessingStatus {
override val value: String = "WARNING"
}
case object ProcessingIgnore extends ProcessingStatus {
override val value: String = "IGNORE"
}
case object ProcessingFatal extends ProcessingStatus {
override val value: String = "FATAL"
}
case class ReportingObject(id: String, status: ProcessingStatus, message: String) {
case class ReportingObject(
id: String,
status: ProcessingStatus,
message: String
) {
val dateFormatter = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ss.SSS")
override def toString: String =
s"""{"step": "media-metadata-preprocessor", "timestamp": "$createTimestamp", "id": "$id", "status": "${
status match {
case ProcessingSuccess => "SUCCESS"
case ProcessingFailure => "FAILURE"
}
}", "message": "${escapeApostrophes(message)}"}"""
s"""{"step": "media-metadata-preprocessor", "timestamp": "$createTimestamp", "id": "$id", "status": "${status match {
case ProcessingSuccess => ProcessingSuccess.value
case ProcessingIgnore => ProcessingIgnore.value
case ProcessingWarning => ProcessingWarning.value
case ProcessingFatal => ProcessingFatal.value
}}", "message": "${escapeApostrophes(message)}"}"""
}
object ReportingObject {
val dateFormatter = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ss.SSS")
def createTimestamp: String = dateFormatter.format(Calendar.getInstance().getTime)
def createTimestamp: String =
dateFormatter.format(Calendar.getInstance().getTime)
def escapeApostrophes(value: String): String = {
value.replaceAll(""""""", """\\"""")
......
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