gosonzhang commented on a change in pull request #125:
URL: https://github.com/apache/incubator-tubemq/pull/125#discussion_r435278576



##########
File path: 
tubemq-client/src/main/java/org/apache/tubemq/client/producer/SimpleMessageProducer.java
##########
@@ -335,11 +336,13 @@ private void checkMessageAndStatus(final Message message) 
throws TubeClientExcep
     }
 
     private byte[] encodePayload(final Message message) {
-        final byte[] payload = message.getData();
-        final String attribute = message.getAttribute();
+        byte[] payload = message.getData();
+        String attribute = message.getAttribute();
         if (TStringUtils.isBlank(attribute)) {
-            return payload;
+            attribute = "";
         }
+        attribute = attribute + "," + TokenConstants.TOKEN_COMPRESS_TYPE + 
producerConfig.getCompressionType().name();

Review comment:
       The attribute item in the attribute needs to be added in a=b, c=d mode 
and has a fixed format. It is best to call the method of Message to add the 
attribute item in this place, instead of seeming to manually stitch together to 
avoid incompatibility after adjusting the encoding




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to