RobertIndie commented on PR #1059:
URL: 
https://github.com/apache/pulsar-client-go/pull/1059#issuecomment-1644116053

   Seems that in the Java client, the producer will fail all messages that are 
in the pending queue when closing:
   
https://github.com/apache/pulsar/blob/2bede012c73c301b73c079aaeb122cbb472728c1/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L1079
   
https://github.com/apache/pulsar/blob/2bede012c73c301b73c079aaeb122cbb472728c1/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L1098
   ```java
   cnx.sendRequestWithId(cmd, requestId).handle((v, exception) -> {
               cnx.removeProducer(producerId);
               if (exception == null || !cnx.ctx().channel().isActive()) {
                   // Either we've received the success response for the close 
producer command from the broker, or the
                   // connection did break in the meantime. In any case, the 
producer is gone.
                   log.info("[{}] [{}] Closed Producer", topic, producerName);
                   closeAndClearPendingMessages();  // <- we call 
failPendingMessages in closeAndClearPendingMessages
                   closeFuture.complete(null);
               } else {
                   closeFuture.completeExceptionally(exception);
               }
   
               return null;
           });
   ```
   
   


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