You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/05/23 07:50:44 UTC
[GitHub] [pulsar] wolfstudy opened a new pull request #4348: Support max
message size for cpp and go client
wolfstudy opened a new pull request #4348: Support max message size for cpp and go client
URL: https://github.com/apache/pulsar/pull/4348
Signed-off-by: xiaolong.ran <ra...@gmail.com>
### Motivation
support max message size for cpp and go client.
test code use go-client as follows:
```
func main() {
client, err := pulsar.NewClient(pulsar.ClientOptions{
URL: "pulsar://localhost:6650",
IOThreads: 5,
})
if err != nil {
log.Fatal(err)
}
defer client.Close()
producer, err := client.CreateProducer(pulsar.ProducerOptions{
Topic: "my-topic",
CompressionType: pulsar.NoCompression,
//Batching: false,
})
if err != nil {
log.Fatal(err)
}
defer producer.Close()
ctx := context.Background()
buf := make([]byte, 10*1024*1024)
arrays := [1024*1024*7 - 10*1024 - 1]byte{} // 7MB
buf = arrays[:]
producer.SendAsync(ctx, pulsar.ProducerMessage{
Payload: buf,
}, func(producerMessage pulsar.ProducerMessage, e error) {
fmt.Print("send complete. err=", e)
})
}
```
add standalone.conf:
```
maxMessageSize=10485760
nettyMaxFrameSizeBytes=10496000
```
output as follow:
```
2019/05/23 15:37:56.108 c_client.go:68: [info] INFO | ConnectionPool:72 | Created connection for pulsar://localhost:6650
2019/05/23 15:37:56.111 c_client.go:68: [info] INFO | ClientConnection:313 | [127.0.0.1:60601 -> 127.0.0.1:6650] Connected to broker
2019/05/23 15:37:56.113 c_client.go:68: [info] INFO | ClientConnection:228 | Connection has max message size setting: 10485760
2019/05/23 15:37:56.113 c_client.go:68: [info] INFO | ClientConnection:230 | Connection has max message size setting: 10485760
2019/05/23 15:37:56.117 c_client.go:68: [info] INFO | BatchMessageContainer:43 | { BatchContainer [size = 0] [batchSizeInBytes_ = 0] [maxAllowedMessageBatchSizeInBytes_ = 131072] [maxAllowedNumMessagesInBatch_ = 1000] [topicName = persistent://public/default/my-topic-1] [producerName_ = ] [batchSizeInBytes_ = 0] [numberOfBatchesSent = 0] [averageBatchSize = 0]} BatchMessageContainer constructed
2019/05/23 15:37:56.118 c_client.go:68: [info] INFO | HandlerBase:52 | [persistent://public/default/my-topic-1, ] Getting connection from pool
2019/05/23 15:37:56.124 c_client.go:68: [info] INFO | ConnectionPool:72 | Created connection for pulsar://ranxiaolong:6650
2019/05/23 15:37:56.126 c_client.go:68: [info] INFO | ClientConnection:315 | [127.0.0.1:60602 -> 127.0.0.1:6650] Connected to broker through proxy. Logical broker: pulsar://ranxiaolong:6650
2019/05/23 15:37:56.128 c_client.go:68: [info] INFO | ClientConnection:228 | Connection has max message size setting: 10485760
2019/05/23 15:37:56.517 c_client.go:68: [info] INFO | ProducerImpl:155 | [persistent://public/default/my-topic-1, ] Created producer on broker [127.0.0.1:60602 -> 127.0.0.1:6650]
2019/05/23 15:37:56.567 c_client.go:68: [info] INFO | ProducerImpl:448 | send message Message(prod=standalone-96-2, seq=0, publish_time=1558597076544, payload_size=7329812, msg_id=(-1,-1,-1,-1), props={})
2019/05/23 15:37:56.567 c_client.go:68: [info] INFO | ProducerImpl:460 | [persistent://public/default/my-topic-1, standalone-96-2] Sending msg immediately - seq: 0
2019/05/23 15:37:56.569 c_client.go:68: [info] INFO | ProducerImpl:496 | [persistent://public/default/my-topic-1, standalone-96-2] Closing producer for topic persistent://public/default/my-topic-1
send complete. err= [<nil>]
2019/05/23 15:37:56.639 c_client.go:68: [info] INFO | ProducerImpl:534 | [persistent://public/default/my-topic-1, standalone-96-2] Closed producer
2019/05/23 15:37:56.640 c_client.go:68: [info] INFO | ClientImpl:479 | Closing Pulsar client
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services