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 { ...@@ -43,6 +43,11 @@ class KafkaTopology extends Logging {
recordWithLocator recordWithLocator
) )
sendRecordsDownstream(
locatorlessRecord,
SettingsFromFile.outputTopicIgnore
)
sendRecordsDownstream( sendRecordsDownstream(
unenrichableRecord, unenrichableRecord,
SettingsFromFile.outputTopicIgnore SettingsFromFile.outputTopicIgnore
...@@ -150,8 +155,8 @@ class KafkaTopology extends Logging { ...@@ -150,8 +155,8 @@ class KafkaTopology extends Logging {
k, k,
ReportingObject( ReportingObject(
k, k,
ProcessingFailure, ProcessingWarning,
"Record has no locator! Can't decide on player type." "Record has no locator. Is this intentional (i.e. media file is not accessible)?"
).toString ).toString
) )
) )
......
...@@ -122,7 +122,7 @@ object KafkaTopologyUtils extends Logging { ...@@ -122,7 +122,7 @@ object KafkaTopologyUtils extends Logging {
getMemobasePlayerType(recordType) getMemobasePlayerType(recordType)
case Failure(_) => case Failure(_) =>
logger.warn( 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) getMemobasePlayerType(recordType)
} }
......
...@@ -24,29 +24,44 @@ import java.util.Calendar ...@@ -24,29 +24,44 @@ import java.util.Calendar
import ch.memobase.models.ReportingObject.{createTimestamp, escapeApostrophes} import ch.memobase.models.ReportingObject.{createTimestamp, escapeApostrophes}
sealed trait ProcessingStatus sealed trait ProcessingStatus {
val value: String
case object ProcessingSuccess extends ProcessingStatus }
case object ProcessingFailure extends ProcessingStatus
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") val dateFormatter = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ss.SSS")
override def toString: String = override def toString: String =
s"""{"step": "media-metadata-preprocessor", "timestamp": "$createTimestamp", "id": "$id", "status": "${ s"""{"step": "media-metadata-preprocessor", "timestamp": "$createTimestamp", "id": "$id", "status": "${status match {
status match { case ProcessingSuccess => ProcessingSuccess.value
case ProcessingSuccess => "SUCCESS" case ProcessingIgnore => ProcessingIgnore.value
case ProcessingFailure => "FAILURE" case ProcessingWarning => ProcessingWarning.value
} case ProcessingFatal => ProcessingFatal.value
}", "message": "${escapeApostrophes(message)}"}""" }}", "message": "${escapeApostrophes(message)}"}"""
} }
object ReportingObject { object ReportingObject {
val dateFormatter = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ss.SSS") 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 = { def escapeApostrophes(value: String): String = {
value.replaceAll(""""""", """\\"""") 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