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/10/14 06:43:36 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #5165: [PIP-43] Support producer to send msg with different schema

sijie commented on a change in pull request #5165: [PIP-43] Support producer to send msg with different schema
URL: https://github.com/apache/pulsar/pull/5165#discussion_r334314300
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
 ##########
 @@ -1289,16 +1364,15 @@ private void batchMessageAndSend() {
         }
         if (!batchMessageContainer.isEmpty()) {
             try {
+                List<OpSendMsg> opSendMsgs;
                 if (batchMessageContainer.isMultiBatches()) {
-                    List<OpSendMsg> opSendMsgs = batchMessageContainer.createOpSendMsgs();
-                    for (OpSendMsg opSendMsg : opSendMsgs) {
-                        processOpSendMsg(opSendMsg);
-                    }
+                    opSendMsgs = batchMessageContainer.createOpSendMsgs();
                 } else {
-                    OpSendMsg opSendMsg = batchMessageContainer.createOpSendMsg();
-                    if (opSendMsg != null) {
-                        processOpSendMsg(opSendMsg);
-                    }
+                    opSendMsgs = Collections.singletonList(batchMessageContainer.createOpSendMsg());
 
 Review comment:
   The original code was there to avoid creating collections for non-batching case. I would prefer not rewriting this logic.

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