[ 
https://issues.apache.org/jira/browse/KAFKA-15841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17818535#comment-17818535
 ] 

Henrique Mota commented on KAFKA-15841:
---------------------------------------

That conditional basically prevented us from achieving what we wanted:

!image-2024-02-19-13-48-55-875.png!


The modification below would help us achieve our goal:

 

 
for (Map<String, String> taskProps : taskConfigs) {
  // Ensure we don't modify the connector's copy of the config
  Map<String, String> taskConfig = new HashMap<>(taskProps);
  taskConfig.put(TaskConfig.TASK_CLASS_CONFIG, taskClassName);
  if (connOriginals.containsKey(SinkTask.TOPICS_CONFIG) {*}{color:#de350b}&& 
!taskConfig.containsKey(SinkTask.TOPICS_CONFIG){color}{*}) {
    taskConfig.put(SinkTask.TOPICS_CONFIG, 
connOriginals.get(SinkTask.TOPICS_CONFIG));
  }
  if (connOriginals.containsKey(SinkTask.TOPICS_REGEX_CONFIG) 
{*}{color:#de350b}&& !connOriginals.containsKey(SinkTask.taskConfig){color}{*}) 
{
    taskConfig.put(SinkTask.TOPICS_REGEX_CONFIG, 
connOriginals.get(SinkTask.TOPICS_REGEX_CONFIG));
  }
  result.add(taskConfig);
}
 

 

 

 

> Add Support for Topic-Level Partitioning in Kafka Connect
> ---------------------------------------------------------
>
>                 Key: KAFKA-15841
>                 URL: https://issues.apache.org/jira/browse/KAFKA-15841
>             Project: Kafka
>          Issue Type: Improvement
>          Components: connect
>            Reporter: Henrique Mota
>            Priority: Trivial
>         Attachments: image-2024-02-19-13-48-55-875.png
>
>
> In our organization, we utilize JDBC sink connectors to consume data from 
> various topics, where each topic is dedicated to a specific tenant with a 
> single partition. Recently, we developed a custom sink based on the standard 
> JDBC sink, enabling us to pause consumption of a topic when encountering 
> problematic records.
> However, we face limitations within Kafka Connect, as it doesn't allow for 
> appropriate partitioning of topics among workers. We attempted a workaround 
> by breaking down the topics list within the 'topics' parameter. 
> Unfortunately, Kafka Connect overrides this parameter after invoking the 
> {{taskConfigs(int maxTasks)}} method from the 
> {{org.apache.kafka.connect.connector.Connector}} class.
> We request the addition of support in Kafka Connect to enable the 
> partitioning of topics among workers without requiring a fork. This 
> enhancement would facilitate better load distribution and allow for more 
> flexible configurations, particularly in scenarios where topics are dedicated 
> to different tenants.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to