-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All Kafka Connectors read and write String values. THis is done for c…
…ross platform compatibility reasons.
- Loading branch information
1 parent
e536d12
commit f57bbde
Showing
9 changed files
with
62 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package oml.utils.parsers | ||
|
||
import oml.POJOs.DataInstance | ||
import org.apache.flink.api.common.functions.RichFlatMapFunction | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper | ||
import org.apache.flink.util.Collector | ||
|
||
case class DataInstanceParser() extends RichFlatMapFunction[String, DataInstance] { | ||
|
||
private val mapper: ObjectMapper = new ObjectMapper() | ||
|
||
override def flatMap(record: String, collector: Collector[DataInstance]): Unit = { | ||
val dataInstance = mapper.readValue(record, classOf[DataInstance]) | ||
if (dataInstance.isValid) collector.collect(dataInstance) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package oml.utils.parsers | ||
|
||
import oml.POJOs.Request | ||
import org.apache.flink.api.common.functions.RichFlatMapFunction | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper | ||
import org.apache.flink.util.Collector | ||
|
||
case class RequestParser() extends RichFlatMapFunction[String, Request] { | ||
|
||
private val mapper: ObjectMapper = new ObjectMapper() | ||
|
||
override def flatMap(record: String, collector: Collector[Request]): Unit = { | ||
val request = mapper.readValue(record, classOf[Request]) | ||
if (request.isValid) collector.collect(request) | ||
} | ||
|
||
} |