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/11/17 01:47:32 UTC

[GitHub] [pulsar] xche commented on a change in pull request #8577: [Functions] Delete the message listener and add a thread to get the message from the consumer

xche commented on a change in pull request #8577:
URL: https://github.com/apache/pulsar/pull/8577#discussion_r524832000



##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/PulsarSource.java
##########
@@ -66,7 +71,7 @@ public void open(Map<String, Object> config, SourceContext sourceContext) throws
         // Setup schemas
         log.info("Opening pulsar source with config: {}", pulsarSourceConfig);
         Map<String, ConsumerConfig<T>> configs = setupConsumerConfigs();
-
+        consumerExecutor = Executors.newFixedThreadPool(configs.size(),new DefaultThreadFactory(String.format("%s-%s",sourceContext.getSourceName(), sourceContext.getInstanceId())));

Review comment:
       Because each task instance can consume multiple topics at the same time, each topic has independent threads, which can ensure that it does not affect each other and the performance is optimized
   
   If the thread pool size is 1, the normal consumption of other topics will be blocked because one topic has no data.
   




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