-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example of deserializer for jackson JsonNode (#112)
* Example of deserializer for jackson JsonNode * Install sbt in CI * Install sbt for publish workflow
- Loading branch information
Showing
4 changed files
with
23 additions
and
1 deletion.
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
11 changes: 11 additions & 0 deletions
11
src/main/scala/io/example/conduktor/custom/deserializers/MyCustomJsonNodeDeserializer.scala
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,11 @@ | ||
package io.example.conduktor.custom.deserializers | ||
|
||
import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper} | ||
import org.apache.kafka.common.serialization.Deserializer | ||
|
||
class MyCustomJsonNodeDeserializer extends Deserializer[JsonNode] { | ||
override def deserialize(topic: String, data: Array[Byte]): JsonNode = { | ||
val mapper = new ObjectMapper() | ||
mapper.readTree(data) | ||
} | ||
} |