From 8ac6e5260ccc2d756fcb1153c04eacff388d20a3 Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Mon, 24 Apr 2023 22:03:24 +0800 Subject: [PATCH 1/5] Add producer access mode examples for Java and C++ client. --- docs/client-libraries-producers.md | 39 +++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/client-libraries-producers.md b/docs/client-libraries-producers.md index 8a4aaa691813..553b96ebfc6e 100644 --- a/docs/client-libraries-producers.md +++ b/docs/client-libraries-producers.md @@ -784,4 +784,41 @@ This example shows how to set the `EnforceUnencrypted` encryption policy. -```` \ No newline at end of file +```` + +## Configure Access mode + +Access mode allow applications to require exclusive producer access on a topic in order to achieve a "single-writer" situation. + +More information about access mode can be found [concepts-clients](concepts-clients.md#access-mode). + +This example shows how to set producer accessmode. + +````mdx-code-block + + + + ```java + Producer producer = client.newProducer() + .topic(topic) + .accessMode(ProducerAccessMode.Exclusive) + .create(); + ``` + + + + + + ```cpp + Producer producer; + ProducerConfiguration producerConfiguration; + producerConfiguration.setAccessMode(ProducerConfiguration::Exclusive); + client.createProducer(topicName, producerConfiguration, producer); + ``` + + + + +```` From cebf4a64c224113ef5353c81c4f8330a3e4402d1 Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Mon, 24 Apr 2023 23:01:59 +0800 Subject: [PATCH 2/5] Fix docs format. --- docs/client-libraries-producers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/client-libraries-producers.md b/docs/client-libraries-producers.md index 553b96ebfc6e..f2069d9233a6 100644 --- a/docs/client-libraries-producers.md +++ b/docs/client-libraries-producers.md @@ -792,7 +792,7 @@ Access mode allow applications to require exclusive producer access on a topic i More information about access mode can be found [concepts-clients](concepts-clients.md#access-mode). -This example shows how to set producer accessmode. +This example shows how to set producer access mode. ````mdx-code-block Date: Tue, 25 Apr 2023 09:52:14 +0800 Subject: [PATCH 3/5] Fix code review. --- docs/client-libraries-producers.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/client-libraries-producers.md b/docs/client-libraries-producers.md index f2069d9233a6..e4318b3733b3 100644 --- a/docs/client-libraries-producers.md +++ b/docs/client-libraries-producers.md @@ -786,11 +786,9 @@ This example shows how to set the `EnforceUnencrypted` encryption policy. ```` -## Configure Access mode +## Configure access mode -Access mode allow applications to require exclusive producer access on a topic in order to achieve a "single-writer" situation. - -More information about access mode can be found [concepts-clients](concepts-clients.md#access-mode). +[Access mode](concepts-clients.md#access-mode) allows applications to require exclusive producer access on a topic to achieve a "single-writer" situation. This example shows how to set producer access mode. From 891b28e3886cbdde3ea81beb34f7d3ec92622a2e Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Tue, 25 Apr 2023 11:58:16 +0800 Subject: [PATCH 4/5] Add version remark. --- docs/client-libraries-producers.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/client-libraries-producers.md b/docs/client-libraries-producers.md index e4318b3733b3..7bb1090dd95d 100644 --- a/docs/client-libraries-producers.md +++ b/docs/client-libraries-producers.md @@ -798,6 +798,8 @@ This example shows how to set producer access mode. values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"}]}> + This feature is supported after Java client version 2.8.0. + ```java Producer producer = client.newProducer() .topic(topic) @@ -809,6 +811,8 @@ This example shows how to set producer access mode. + This feature is supported after CPP client version 3.1.0. + ```cpp Producer producer; ProducerConfiguration producerConfiguration; From eefbb6f520c0334d3e23f09eff7a4ad06ef83067 Mon Sep 17 00:00:00 2001 From: Baodi Shi Date: Tue, 25 Apr 2023 18:44:04 +0800 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Anonymitaet <50226895+Anonymitaet@users.noreply.github.com> --- docs/client-libraries-producers.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/client-libraries-producers.md b/docs/client-libraries-producers.md index 7bb1090dd95d..63fe47a1dfdc 100644 --- a/docs/client-libraries-producers.md +++ b/docs/client-libraries-producers.md @@ -798,7 +798,11 @@ This example shows how to set producer access mode. values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"}]}> - This feature is supported after Java client version 2.8.0. +::: note + +This feature is supported in Java client 2.8.0 or later versions. + +::: ```java Producer producer = client.newProducer() @@ -811,7 +815,11 @@ This example shows how to set producer access mode. - This feature is supported after CPP client version 3.1.0. +::: note + +This feature is supported in C++ client 3.1.0 or later versions. + +::: ```cpp Producer producer;