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 2020/04/14 21:08:15 UTC

[GitHub] [pulsar-client-go] cornelk opened a new issue #223: Reader can not read new messages after subscribing with LatestMessageID

cornelk opened a new issue #223: Reader can not read new messages after subscribing with LatestMessageID
URL: https://github.com/apache/pulsar-client-go/issues/223
 
 
   #### Expected behavior
   
   Reading of new messages is possible. 
   
   #### Actual behavior
   
   No message can be read.
   
   #### Steps to reproduce
   
   ```
   func TestReaderLatestMessageID(t *testing.T) {
   	client, err := NewClient(ClientOptions{
   		URL: lookupURL,
   	})
   
   	assert.Nil(t, err)
   	defer client.Close()
   
   	topic := newTopicName()
   	ctx := context.Background()
   
   	// create producer
   	producer, err := client.CreateProducer(ProducerOptions{
   		Topic:                   topic,
   		DisableBatching:         false,
   		BatchingMaxMessages:     4,
   		BatchingMaxPublishDelay: 1 * time.Second,
   	})
   	assert.Nil(t, err)
   	defer producer.Close()
   
   	_, err = producer.Send(ctx, &ProducerMessage{
   		Payload: []byte("hello-0"),
   	})
   	assert.NoError(t, err)
   
   	// create reader on 5th message (not included)
   	reader, err := client.CreateReader(ReaderOptions{
   		Topic:                   topic,
   		StartMessageID:          LatestMessageID(),
   		StartMessageIDInclusive: false,
   	})
   
   	assert.Nil(t, err)
   	defer reader.Close()
   
   	// Reader should yield no message since it's at the end of the topic
   	ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
   	msg, err := reader.Next(ctx)
   	assert.Error(t, err)
   	assert.Nil(t, msg)
   	cancel()
   
   	_, err = producer.Send(ctx, &ProducerMessage{
   		Payload: []byte("hello-1"),
   	})
   	assert.NoError(t, err)
   
   	ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
   	msg, err = reader.Next(ctx)
   	assert.NoError(t, err)
   	assert.NotNil(t, msg)
   	cancel()
   }
   ```
   
   fails to read the last `hello-1` message:
   
   ```
           	Error:      	Received unexpected error:
           	            	context deadline exceeded
   ```
    
   

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

[GitHub] [pulsar-client-go] jiazhai commented on issue #223: Reader can not read new messages after subscribing with LatestMessageID

Posted by GitBox <gi...@apache.org>.
jiazhai commented on issue #223: Reader can not read new messages after subscribing with LatestMessageID
URL: https://github.com/apache/pulsar-client-go/issues/223#issuecomment-613772318
 
 
   looks like a bug @wolfstudy  to take a look.

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