Created
November 14, 2018 21:12
-
-
Save vikas-tikoo-zefr/c68edf760c319105e175394b32f4a01e to your computer and use it in GitHub Desktop.
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
import org.apache.kafka.common.serialization.Deserializer | |
import io.confluent.kafka.schemaregistry.client.SchemaRegistryClient | |
import io.confluent.kafka.serializers.KafkaAvroDeserializer | |
class StringAvroDeserializer : Deserializer<String> { | |
private val inner: KafkaAvroDeserializer | |
constructor() { | |
inner = KafkaAvroDeserializer() | |
} | |
/** | |
* For testing purposes only. | |
*/ | |
internal constructor(client: SchemaRegistryClient) { | |
inner = KafkaAvroDeserializer(client) | |
} | |
override fun configure(deserializerConfig: Map<String, *>, | |
isDeserializerForRecordKeys: Boolean) { | |
inner.configure(deserializerConfig, isDeserializerForRecordKeys) | |
} | |
override fun deserialize(topic: String, bytes: ByteArray): String { | |
return inner.deserialize(topic, bytes) as String | |
} | |
override fun close() { | |
inner.close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment