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 2022/04/26 04:09:46 UTC

[GitHub] [pulsar] AnonHxy opened a new pull request, #15327: [client]Chechk schema null in advance

AnonHxy opened a new pull request, #15327:
URL: https://github.com/apache/pulsar/pull/15327

   ### Motivation
   
   * If we set `scheam` as null when using `PulsarClient` new consumer or producer like this:
   ```Consumer<?> consumer = client.newConsumer(null)
                   .topic(topic)
                   .subscriptionName(subscription)
                   .subscribe();
   ```
   It does not throw exceptions before consumer buid, but will throw exceptions when `org.apache.pulsar.client.impl.ConsumerImpl#connectionOpened` invoked, then try to reconnect later:
   <img width="1772" alt="image" src="https://user-images.githubusercontent.com/10233437/165218210-0203a233-47f8-4223-9c5f-3cde3505f786.png">
   
   * For detail, the code where throws exception is located at: 
   https://github.com/apache/pulsar/blob/74eae1a729c33c9fead9d54594bdee5fac8ab153/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L827
   
   
   ### Modifications
   
   If `schema` is null, throw exceptions when buiding the consumer or producer
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   
   
   ### Documentation
     
   - [x] `no-need-doc` 
     
   


-- 
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] AnonHxy commented on a diff in pull request #15327: [client]Check consumer schema null in advance

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on code in PR #15327:
URL: https://github.com/apache/pulsar/pull/15327#discussion_r858769378


##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/PulsarClientImplTest.java:
##########
@@ -225,6 +226,20 @@ public void testResourceCleanup() throws PulsarClientException {
         }
     }
 
+    @Test
+    public void testConsumerSchemaNull() throws PulsarClientException {
+        @Cleanup

Review Comment:
   OK. PTAL @RobertIndie 



-- 
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] RobertIndie commented on a diff in pull request #15327: [client]Check consumer schema null in advance

Posted by GitBox <gi...@apache.org>.
RobertIndie commented on code in PR #15327:
URL: https://github.com/apache/pulsar/pull/15327#discussion_r858739129


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java:
##########
@@ -77,6 +77,7 @@ public ConsumerBuilderImpl(PulsarClientImpl client, Schema<T> schema) {
     }
 
     ConsumerBuilderImpl(PulsarClientImpl client, ConsumerConfigurationData<T> conf, Schema<T> schema) {
+        checkArgument(schema != null, "schema should not be null");

Review Comment:
   ```suggestion
           checkArgument(schema != null, "Schema should not be null.");
   ```



##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/PulsarClientImplTest.java:
##########
@@ -225,6 +226,20 @@ public void testResourceCleanup() throws PulsarClientException {
         }
     }
 
+    @Test
+    public void testConsumerSchemaNull() throws PulsarClientException {
+        @Cleanup

Review Comment:
   This doesn't seem to be part of the PulsarClientImpl test, we should move it to the consumer test.



-- 
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] lhotari merged pull request #15327: [client]Check consumer schema null in advance

Posted by GitBox <gi...@apache.org>.
lhotari merged PR #15327:
URL: https://github.com/apache/pulsar/pull/15327


-- 
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] AnonHxy commented on pull request #15327: [client]Chechk consumer schema null in advance

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #15327:
URL: https://github.com/apache/pulsar/pull/15327#issuecomment-1109501766

   /pulsarbot run-failure-checks


-- 
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] AnonHxy commented on pull request #15327: [client]Check consumer schema null in advance

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #15327:
URL: https://github.com/apache/pulsar/pull/15327#issuecomment-1110460643

   /pulsarbot run-failure-checks


-- 
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] AnonHxy commented on pull request #15327: [client]Chechk schema null in advance

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #15327:
URL: https://github.com/apache/pulsar/pull/15327#issuecomment-1109368581

   /pulsarbot run-failure-checks


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