jack-tristan opened a new issue, #847:
URL: https://github.com/apache/pulsar-client-go/issues/847

   #### Expected behavior
   
   Settings: Schema=StringSchema, CompressionType=pulsar.LZ4[, 
DisableBatching=true]
   pulsar-client-go version: v0.8.0 & v0.8.1
   when: string size > 132000 and size < 5MB,  producer can send message 
normally
   
   #### Actual behavior
   
   when string size > 132000, program will throw "unable to add message to 
batch" (message add to batch failed: AddToBatchFailed)
   
   #### Steps to reproduce
   
   ```
   func main(){
        ProducerString(genStr(132000)) // when the string size > 132000,program 
will throw "unable to add message to batch" using pulsar-client-go version 
v0.8.0 & v0.8.1
   }
   
   // generate test string
   func genStr(size int) string {
        var builder strings.Builder
        for i:=0; i < size; i++ {
                builder.WriteString("a")
                //builder.WriteString("abcdefghi,")
        }
        return builder.String()
   }
   
   // producer to send msg
   func ProducerString(str string) {
        client, err := pulsar.NewClient(pulsar.ClientOptions{
                URL: pulsar://10.200.19.3:6650,
                OperationTimeout:  30 * time.Second,
                ConnectionTimeout: 30 * time.Second,
        })
        if err != nil {
                utils.Logger.Fatal(err)
                return
        }
        defer client.Close()
   
        producer, err := client.CreateProducer(pulsar.ProducerOptions{
                Topic:  "persistent://test-zdh/test/pt-longstr-v1",
                Schema: pulsar.NewStringSchema(nil),
                CompressionType: pulsar.LZ4,
                DisableBatching: true,
        })
        defer producer.Close()
   
        msgID, err := producer.Send(context.Background(), 
&pulsar.ProducerMessage{
                Value: str,
        })
        if err != nil {
                utils.Logger.Fatal(err)
        }
        utils.Logger.Info(msgID)
   }
   ```
   
   #### System configuration
   **Pulsar version**: v2.6.3
   **pulsar-client-go bug version**: v0.8.0 & v0.8.1
   **go version**: 1.15.12


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to