From bc2f2d4113defffc9878df4938d885a112707883 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Fri, 5 Jun 2020 13:33:33 +0200 Subject: [PATCH] Improve README formatting --- .../README.adoc | 27 +++++++++++-------- .../schema-registry-confluent/README.adoc | 22 ++++++++------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/schema-registry-samples/schema-registry-confluent-avro-serializer/README.adoc b/schema-registry-samples/schema-registry-confluent-avro-serializer/README.adoc index 706f4ca..066a3c2 100644 --- a/schema-registry-samples/schema-registry-confluent-avro-serializer/README.adoc +++ b/schema-registry-samples/schema-registry-confluent-avro-serializer/README.adoc @@ -115,19 +115,20 @@ Once you are done with running the samples, stop the docker containers `docker-compose down` -==== Using Confluent Command Center +=== Using Confluent Command Center This test can be run with the [Confluent Command Center](https://docs.confluent.io/current/control-center/index.html) - a web-based tool for managing and monitoring Apache Kafka®. Control Center facilitates building and monitoring production data pipelines and streaming applications. For a quick start you can install the command center with the help of the `docker-compose-control-center.yaml`: -``` +[source,bash] +---- docker-compose -f ./docker-compose-control-center.yaml -``` +---- -For further info check the Confluent's [Quick Start](https://docs.confluent.io/current/quickstart/ce-docker-quickstart.html). +For further info check the Confluent's https://docs.confluent.io/current/quickstart/ce-docker-quickstart.html[Quick Start]. -The [Schema Registry feature in Control Center](https://docs.confluent.io/current/control-center/topics/schema.html) would help you to visualize and manage the topic schemas. +The https://docs.confluent.io/current/control-center/topics/schema.html[Schema Registry feature in Control Center] would help you to visualize and manage the topic schemas. After you run the samples and post couple of messages as explained above. @@ -139,14 +140,16 @@ After you run the samples and post couple of messages as explained above. You can also use the Confluent Schema REST API at `http://localhost:8081`. For example the `http://localhost:8081/subjects` will list the schema names (e.g. subjects) defined. After you have run the samples you should be able to see a schema subject name `sensor-topic-value`. -===== NOTE +==== NOTE -By default Kafka uses the [TopicNameStrategy](https://docs.confluent.io/current/schema-registry/serdes-develop/index.html) to create the name of the message payload schema. Later means that the schema is named after your topic name (e.g. spring.cloud.stream.bindings.:destination) with `-value` suffix. +By default Kafka uses the https://docs.confluent.io/current/schema-registry/serdes-develop/index.html[TopicNameStrategy] to create the name of the message payload schema. Later means that the schema is named after your topic name (e.g. spring.cloud.stream.bindings.:destination) with `-value` suffix. That means that by default you can use a single schema per topic. The subject naming strategy can be changed to `RecordNameStrategy` or `TopicRecordNameStrategy` with the help of the `spring.cloud.stream.kafka.binder.consumerProperties` and `spring.cloud.stream.kafka.binder.producerProperties` properties like this: Extend your consumer configuration like this: -``` + +[source,yaml] +---- spring: cloud: stream: @@ -158,10 +161,12 @@ spring: subject: name: strategy: io.confluent.kafka.serializers.subject.RecordNameStrategy -``` +---- Extend your producer configuration like this: -``` + +[source,yaml] +---- spring: cloud: stream: @@ -173,7 +178,7 @@ spring: subject: name: strategy: io.confluent.kafka.serializers.subject.RecordNameStrategy -``` +---- Note that currently the Command Center seams to be recognizing only the subjects created with `TopicNameStrategy` . If you configure the `RecordNameStrategy` they schema will not appear in the UI. diff --git a/schema-registry-samples/schema-registry-confluent/README.adoc b/schema-registry-samples/schema-registry-confluent/README.adoc index 9225988..d1eb1c9 100644 --- a/schema-registry-samples/schema-registry-confluent/README.adoc +++ b/schema-registry-samples/schema-registry-confluent/README.adoc @@ -112,18 +112,19 @@ Once you are done with running the samples, stop the docker containers and stop the Confluent Schema Registry server. -==== Using Confluent Command Center +=== Using Confluent Command Center This test can be run with the [Confluent Command Center](https://docs.confluent.io/current/control-center/index.html) - a web-based tool for managing and monitoring Apache Kafka®. Control Center facilitates building and monitoring production data pipelines and streaming applications. For a quick start you can install the command center with the help of the `docker-compose-control-center.yaml`: -``` +[source,bash] +---- docker-compose -f ./docker-compose-control-center.yaml -``` +---- -For further info check the Confluent's [Quick Start](https://docs.confluent.io/current/quickstart/ce-docker-quickstart.html). -The [Schema Registry feature in Control Center](https://docs.confluent.io/current/control-center/topics/schema.html) would help you to visualize and manage the topic schemas. +For further info check the Confluent's https://docs.confluent.io/current/quickstart/ce-docker-quickstart.html[Quick Start]. +The https://docs.confluent.io/current/control-center/topics/schema.html[Schema Registry feature in Control Center] would help you to visualize and manage the topic schemas. After you run the samples and post couple of messages as explained above. @@ -135,18 +136,19 @@ After you run the samples and post couple of messages as explained above. You can also use the Confluent Schema REST API at `http://localhost:8081`. For example the `http://localhost:8081/subjects` will list the schema names (e.g. subjects) defined. After you have run the samples you should be able to see a schema subject name `sensor-topic-value`. -===== NOTE +==== NOTE -Note that currently the Command Center recognizes only schema subjects created with [TopicNameStrategy](https://docs.confluent.io/current/schema-registry/serdes-develop/index.html). +Note that currently the Command Center recognizes only schema subjects created with https://docs.confluent.io/current/schema-registry/serdes-develop/index.html[TopicNameStrategy]. That means that the schema name (e.g. subject) must be named after your topic name (e.g. spring.cloud.stream.bindings.:destination) followed by `-value` suffix. In our sample the topic (e.g. destination) is called `sensor-topic`. Therefore the schema subject should be named `sensor-topic-value` to be recognizable by the Confluent command center. -Note that the confluent schema registry works fine with different subject naming strategies, only the command center visualizaiton will not show them. +Note that the confluent schema registry works fine with different subject naming strategies, only the command center visualization will not show them. To configure a the schema name after the topic name yuo can use the `spring.cloud.schema.avro.subjectNamePrefix` and `spring.cloud.schema.avro.subjectNamePrefix.subjectNamingStrategy` properties as shown below (only available with 1.1.x onwards: -``` +[source,yaml] +---- spring: cloud: stream: @@ -161,6 +163,6 @@ spring: subjectNamePrefix: sensor-topic-value subjectNamingStrategy: org.springframework.cloud.schema.registry.avro.SubjectPrefixOnlyNamingStrategy server.port: 9999 -``` +---- The `subjectNamePrefix` must be set to the value of your `destination` followed by `-value` suffix. The `subjectNamingStrategy` must be set to `SubjectPrefixOnlyNamingStrategy`.