From 5092b26393de731e8f826fde86b7ea97c9aaba35 Mon Sep 17 00:00:00 2001 From: Victoria Bialas Date: Tue, 19 Mar 2019 15:01:59 -0700 Subject: [PATCH] MINOR: update docs JSON serde links (#6465) Reviewers: Joel Mamill , Matthias J. Sax --- docs/streams/developer-guide/datatypes.html | 23 +++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/streams/developer-guide/datatypes.html b/docs/streams/developer-guide/datatypes.html index 6c7869c3ba1..ca17c0b6362 100644 --- a/docs/streams/developer-guide/datatypes.html +++ b/docs/streams/developer-guide/datatypes.html @@ -112,7 +112,7 @@ </dependency> -

This artifact provides the following serde implementations under the package org.apache.kafka.common.serialization, which you can leverage when e.g., defining default serializers in your Streams configuration.

+

This artifact provides the following serde implementations under the package org.apache.kafka.common.serialization, which you can leverage when e.g., defining default serializers in your Streams configuration.

@@ -149,20 +149,17 @@

Tip

-

Bytes is a wrapper for Java’s byte[] (byte array) that supports proper equality and ordering semantics. You may want to consider using Bytes instead of byte[] in your applications.

+

Bytes is a wrapper for Java’s byte[] (byte array) that supports proper equality and ordering semantics. You may want to consider using Bytes instead of byte[] in your applications.

JSON

-

The code examples of Kafka Streams also include a basic serde implementation for JSON:

+

The Kafka Streams code examples also include a basic serde implementation for JSON:

-

You can construct a unified JSON serde from the JsonPOJOSerializer and JsonPOJODeserializer via - Serdes.serdeFrom(<serializerInstance>, <deserializerInstance>). The - PageViewTypedDemo - example demonstrates how to use this JSON serde.

+

As shown in the example, you can use JSONSerdes inner classes Serdes.serdeFrom(<serializerInstance>, <deserializerInstance>) to construct JSON compatible serializers and deserializers. +

Implementing custom SerDes

@@ -170,13 +167,13 @@ existing SerDes (see previous section). Typically, your workflow will be similar to:

  1. Write a serializer for your data type T by implementing - org.apache.kafka.common.serialization.Serializer.
  2. + org.apache.kafka.common.serialization.Serializer.
  3. Write a deserializer for T by implementing - org.apache.kafka.common.serialization.Deserializer.
  4. + org.apache.kafka.common.serialization.Deserializer.
  5. Write a serde for T by implementing - org.apache.kafka.common.serialization.Serde, + org.apache.kafka.common.serialization.Serde, which you either do manually (see existing SerDes in the previous section) or by leveraging helper functions in - Serdes + Serdes such as Serdes.serdeFrom(Serializer<T>, Deserializer<T>). Note that you will need to implement your own class (that has no generic types) if you want to use your custom serde in the configuration provided to KafkaStreams. If your serde class has generic types or you use Serdes.serdeFrom(Serializer<T>, Deserializer<T>), you can pass your serde only