wolfstudy opened a new issue #60: The flow of multi-Partition consumer can't  
work
URL: https://github.com/apache/pulsar-client-go/issues/60
 
 
   #### Expected behavior
   
   The flow of multi-Partition consumer can correct  work
   
   #### Actual behavior
   
   The receive blocked.
   
   #### Steps to reproduce
   
   ```
   func TestPartitionTopicsConsumerPubSub(t *testing.T) {
        client, err := NewClient(ClientOptions{
                URL: lookupURL,
        })
        assert.Nil(t, err)
        defer client.Close()
   
        topic := "persistent://public/default/testGetPartitions-2"
        testURL := adminURL + "/" + 
"admin/v2/persistent/public/default/testGetPartitions-2/partitions"
   
        makeHTTPCall(t, http.MethodPut, testURL, "3")
   
        // create producer
        producer, err := client.CreateProducer(ProducerOptions{
                Topic: topic,
        })
        assert.Nil(t, err)
        defer producer.Close()
   
        topics, err := client.TopicPartitions(topic)
        assert.Nil(t, err)
        assert.Equal(t, topic+"-partition-0", topics[0])
        assert.Equal(t, topic+"-partition-1", topics[1])
        assert.Equal(t, topic+"-partition-2", topics[2])
   
        consumer, err := client.Subscribe(ConsumerOptions{
                Topic:             topic,
                SubscriptionName:  "my-sub-1",
                Type:              Exclusive,
                ReceiverQueueSize: 10,
        })
        assert.Nil(t, err)
        defer consumer.Close()
   
        ctx := context.Background()
        for i := 0; i < 500; i++ {
                err := producer.Send(ctx, &ProducerMessage{
                        Payload: []byte(fmt.Sprintf("hello-%d", i)),
                })
                assert.Nil(t, err)
        }
   
        msgs := make([]string, 0)
   
        for i := 0; i < 500; i++ {
                msg, err := consumer.Receive(ctx)
                assert.Nil(t, err)
                msgs = append(msgs, string(msg.Payload()))
   
                fmt.Printf("Received message msgId: %#v -- content: '%s'\n",
                        msg.ID(), string(msg.Payload()))
                //
                //if err := consumer.Ack(msg); err != nil {
                //      assert.Nil(t, err)
                //}
        }
   
        assert.Equal(t, len(msgs), 500)
   }
   ```
   
   #### System configuration
   **Pulsar version**: x.y
   

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


With regards,
Apache Git Services

Reply via email to