You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "CrazyCollin (via GitHub)" <gi...@apache.org> on 2023/03/08 08:42:10 UTC

[GitHub] [pulsar-client-go] CrazyCollin opened a new pull request, #987: [feat] Expose the chunk config of consumer to the reader

CrazyCollin opened a new pull request, #987:
URL: https://github.com/apache/pulsar-client-go/pull/987

   <!--
   ### Contribution Checklist
     
     - Name the pull request in the form "[Issue XYZ][component] Title of the pull request", where *XYZ* should be replaced by the actual issue number.
       Skip *Issue XYZ* if there is no associated github issue for this pull request.
       Skip *component* if you are unsure about which is the best component. E.g. `[docs] Fix typo in produce method`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   
   Fixes #935 
   
   
   ### Motivation
   
   Support expose the chunk config of consumer to the reader
   
   ### Modifications
   
   Add chunk config related filed in `ReaderOptions` struct.
   
   ### Verifying this change
   
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API: (yes / **no**)
     - The schema: (yes / **no** / don't know)
     - The default values of configurations: (yes / **no**)
     - The wire protocol: (yes / **no**)
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] RobertIndie commented on a diff in pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "RobertIndie (via GitHub)" <gi...@apache.org>.
RobertIndie commented on code in PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987#discussion_r1130316355


##########
pulsar/reader_test.go:
##########
@@ -70,6 +70,49 @@ func TestReaderConfigSubscribeName(t *testing.T) {
 	assert.NotNil(t, consumer)
 }
 
+func TestReaderConfigChunk(t *testing.T) {
+	client, err := NewClient(ClientOptions{
+		URL: lookupURL,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer client.Close()
+
+	consumer1, err := client.CreateReader(ReaderOptions{
+		Topic:                       "my-topic1",
+		StartMessageID:              EarliestMessageID(),
+		MaxPendingChunkedMessage:    50,
+		ExpireTimeOfIncompleteChunk: 30 * time.Second,
+		AutoAckIncompleteChunk:      true,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}

Review Comment:
   Please use `assert.NotNil(t, err)`



##########
pulsar/reader_test.go:
##########
@@ -70,6 +70,49 @@ func TestReaderConfigSubscribeName(t *testing.T) {
 	assert.NotNil(t, consumer)
 }
 
+func TestReaderConfigChunk(t *testing.T) {
+	client, err := NewClient(ClientOptions{
+		URL: lookupURL,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer client.Close()
+
+	consumer1, err := client.CreateReader(ReaderOptions{
+		Topic:                       "my-topic1",
+		StartMessageID:              EarliestMessageID(),
+		MaxPendingChunkedMessage:    50,
+		ExpireTimeOfIncompleteChunk: 30 * time.Second,
+		AutoAckIncompleteChunk:      true,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer consumer1.Close()

Review Comment:
   ```suggestion
   	r1, err := client.CreateReader(ReaderOptions{
   		Topic:                       "my-topic1",
   		StartMessageID:              EarliestMessageID(),
   		MaxPendingChunkedMessage:    50,
   		ExpireTimeOfIncompleteChunk: 30 * time.Second,
   		AutoAckIncompleteChunk:      true,
   	})
   	if err != nil {
   		t.Fatal(err)
   	}
   	defer r1.Close()
   ```
   Same to the `consumer2` below.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] RobertIndie commented on a diff in pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "RobertIndie (via GitHub)" <gi...@apache.org>.
RobertIndie commented on code in PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987#discussion_r1130582077


##########
pulsar/reader.go:
##########
@@ -92,6 +92,16 @@ type ReaderOptions struct {
 	// BackoffPolicy parameterize the following options in the reconnection logic to
 	// allow users to customize the reconnection logic (minBackoff, maxBackoff and jitterPercentage)
 	BackoffPolicy internal.BackoffPolicy
+
+	// MaxPendingChunkedMessage sets the maximum pending chunked messages. (default: 100)
+	MaxPendingChunkedMessage int
+
+	// ExpireTimeOfIncompleteChunk sets the expiry time of discarding incomplete chunked message. (default: 60 seconds)
+	ExpireTimeOfIncompleteChunk time.Duration
+
+	// AutoAckIncompleteChunk sets whether consumer auto acknowledges incomplete chunked message when it should
+	// be removed (e.g.the chunked message pending queue is full). (default: false)
+	AutoAckIncompleteChunk bool

Review Comment:
   ```suggestion
   	// AutoAckIncompleteChunk sets whether reader auto acknowledges incomplete chunked message when it should
   	// be removed (e.g.the chunked message pending queue is full). (default: false)
   	AutoAckIncompleteChunk bool
   ```



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] CrazyCollin commented on a diff in pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "CrazyCollin (via GitHub)" <gi...@apache.org>.
CrazyCollin commented on code in PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987#discussion_r1130583553


##########
pulsar/reader.go:
##########
@@ -92,6 +92,16 @@ type ReaderOptions struct {
 	// BackoffPolicy parameterize the following options in the reconnection logic to
 	// allow users to customize the reconnection logic (minBackoff, maxBackoff and jitterPercentage)
 	BackoffPolicy internal.BackoffPolicy
+
+	// MaxPendingChunkedMessage sets the maximum pending chunked messages. (default: 100)
+	MaxPendingChunkedMessage int
+
+	// ExpireTimeOfIncompleteChunk sets the expiry time of discarding incomplete chunked message. (default: 60 seconds)
+	ExpireTimeOfIncompleteChunk time.Duration
+
+	// AutoAckIncompleteChunk sets whether consumer auto acknowledges incomplete chunked message when it should
+	// be removed (e.g.the chunked message pending queue is full). (default: false)
+	AutoAckIncompleteChunk bool

Review Comment:
   Thank you so much!



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] CrazyCollin commented on pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "CrazyCollin (via GitHub)" <gi...@apache.org>.
CrazyCollin commented on PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987#issuecomment-1459764406

   Hi, @RobertIndie @shibd ,can you review it for me when you are free, many thanks.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] RobertIndie commented on a diff in pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "RobertIndie (via GitHub)" <gi...@apache.org>.
RobertIndie commented on code in PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987#discussion_r1131010040


##########
pulsar/reader_test.go:
##########
@@ -70,6 +70,49 @@ func TestReaderConfigSubscribeName(t *testing.T) {
 	assert.NotNil(t, consumer)
 }
 
+func TestReaderConfigChunk(t *testing.T) {
+	client, err := NewClient(ClientOptions{
+		URL: lookupURL,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer client.Close()
+
+	consumer1, err := client.CreateReader(ReaderOptions{
+		Topic:                       "my-topic1",
+		StartMessageID:              EarliestMessageID(),
+		MaxPendingChunkedMessage:    50,
+		ExpireTimeOfIncompleteChunk: 30 * time.Second,
+		AutoAckIncompleteChunk:      true,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}

Review Comment:
   Yes. You're right. My mistake.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] CrazyCollin commented on a diff in pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "CrazyCollin (via GitHub)" <gi...@apache.org>.
CrazyCollin commented on code in PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987#discussion_r1130364401


##########
pulsar/reader_test.go:
##########
@@ -70,6 +70,49 @@ func TestReaderConfigSubscribeName(t *testing.T) {
 	assert.NotNil(t, consumer)
 }
 
+func TestReaderConfigChunk(t *testing.T) {
+	client, err := NewClient(ClientOptions{
+		URL: lookupURL,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer client.Close()
+
+	consumer1, err := client.CreateReader(ReaderOptions{
+		Topic:                       "my-topic1",
+		StartMessageID:              EarliestMessageID(),
+		MaxPendingChunkedMessage:    50,
+		ExpireTimeOfIncompleteChunk: 30 * time.Second,
+		AutoAckIncompleteChunk:      true,
+	})
+	if err != nil {
+		t.Fatal(err)
+	}

Review Comment:
   Thank you for your advice, but a little confused to me, shouldn't `assert.Nil` be used here? 



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] shibd merged pull request #987: [feat] Expose the chunk config of consumer to the reader

Posted by "shibd (via GitHub)" <gi...@apache.org>.
shibd merged PR #987:
URL: https://github.com/apache/pulsar-client-go/pull/987


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org