This is an automated email from the ASF dual-hosted git repository.
zixuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 29461bd49c3 [doc] [client] [go] Add chunking to go-client doc (#17789)
29461bd49c3 is described below
commit 29461bd49c3ba7bf8d1221c05343d90527fef780
Author: Jiaqi Shen <[email protected]>
AuthorDate: Wed Oct 26 22:50:16 2022 +0800
[doc] [client] [go] Add chunking to go-client doc (#17789)
* add go-client chunking doc
* Update site2/docs/client-libraries-go.md
Co-authored-by: Zixuan Liu <[email protected]>
* Update site2/docs/client-libraries-go.md
Co-authored-by: Anonymitaet <[email protected]>
* Update site2/docs/client-libraries-go.md
Co-authored-by: Anonymitaet <[email protected]>
* Update site2/docs/client-libraries-go.md
Co-authored-by: Anonymitaet <[email protected]>
Co-authored-by: Zixuan Liu <[email protected]>
Co-authored-by: Anonymitaet <[email protected]>
---
site2/docs/client-libraries-go.md | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/site2/docs/client-libraries-go.md
b/site2/docs/client-libraries-go.md
index 8ca9f269f5e..14b331409ce 100644
--- a/site2/docs/client-libraries-go.md
+++ b/site2/docs/client-libraries-go.md
@@ -204,6 +204,34 @@ for i := 0; i < 10; i++ {
}
```
+#### How to use chunking in producer
+
+```go
+client, err := pulsar.NewClient(pulsar.ClientOptions{
+ URL: serviceURL,
+})
+
+if err != nil {
+ log.Fatal(err)
+}
+defer client.Close()
+
+// The message chunking feature is OFF by default.
+// By default, a producer chunks the large message based on the max message
size (`maxMessageSize`) configured at the broker side (for example, 5MB).
+// Client can also configure the max chunked size using the producer
configuration `ChunkMaxMessageSize`.
+// Note: to enable chunking, you need to disable batching
(`DisableBatching=true`) concurrently.
+producer, err := client.CreateProducer(pulsar.ProducerOptions{
+ Topic: "my-topic",
+ DisableBatching: true,
+ EnableChunking: true,
+})
+
+if err != nil {
+ log.Fatal(err)
+}
+defer producer.Close()
+```
+
#### How to use schema interface in producer
```go