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 2020/05/28 01:18:38 UTC

[GitHub] [pulsar-client-go] wolfstudy commented on a change in pull request #263: [Issue 240] Add check for max message size

wolfstudy commented on a change in pull request #263:
URL: https://github.com/apache/pulsar-client-go/pull/263#discussion_r431529838



##########
File path: pulsar/producer_partition.go
##########
@@ -236,6 +239,16 @@ func (p *partitionProducer) internalSend(request *sendRequest) {
 
 	msg := request.msg
 
+	// if msg is too large
+	if len(msg.Payload) > int(p.cnx.GetMaxMessageSize()) {
+		p.publishSemaphore.Release()
+		request.callback(nil, request.msg, errMessageTooLarge)
+		p.log.WithField("size", len(msg.Payload)).
+			WithField("properties", msg.Properties).
+			Error("message size exceeds MaxMessageSize")

Review comment:
       Thanks @jinfengnarvar thanks for pointing this out.
   
   Currently, there are some inconsistencies in the handling of errors. In order to ensure the structured output of the log, we should use `withError()` instead of `Error()`.




----------------------------------------------------------------
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