crossoverJie opened a new issue #503:
URL: https://github.com/apache/pulsar-client-go/issues/503


   #### Expected behavior
   They are different IDs, and the message was sent successfully.
   
   
   #### Actual behavior
   
   ```
   14620:160:0 Published message:abc 
   14620:160:0 Published message:def 
   ```
   Sometimes returns the same MessageID, and one of the messages failed to be 
sent.
   
   
   #### Steps to reproduce
   
   ```go
        msgList := [][]byte{[]byte("abc"), []byte("def")}
        for _, msg := range msgList {
                producer.SendAsync(context.Background(), 
&pulsar.ProducerMessage{
                        Payload: msg,
                }, func(messageID pulsar.MessageID, producerMessage 
*pulsar.ProducerMessage, err error) {
                        if err != nil {
                                fmt.Println("Failed to publish message", err)
                                return
                        }
                        fmt.Printf("%s Published message:%v \n", messageID, 
string(producerMessage.Payload))
                })
        }
   ```
   
   But the Java client does not have this problem.
   
   ```java
           List<String> msgList = new ArrayList<>();
           msgList.add("abc");
           msgList.add("def");
           msgList.forEach(msg -> {
               producer.sendAsync(msg.getBytes()).thenAccept(msgId -> {
                   System.out.printf("Message with ID %s successfully sent \n", 
msgId);
               });
           });
   ```
   
   output:
   ```
   Message with ID 14620:155:-1:0 successfully sent
   Message with ID 14620:156:-1:0 successfully sent
   ```
   
   #### System configuration
   **Pulsar version**: 2.7.1
   Go SDK: v0.3.0
   Java SDK: 2.7.1
   


-- 
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:
[email protected]


Reply via email to