# Source connector: retrieve the current task.count?

**URL:** <https://forum.confluent.io/t/source-connector-retrieve-the-current-task-count/10072>\
**Category:** Kafka Connect\
**Created:** [8 February 2024 06:45 UTC](https://forum.confluent.io/t/source-connector-retrieve-the-current-task-count/10072 "2024-02-08T06:45:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Teehan](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mark\_Teehan](https://forum.confluent.io/u/Mark_Teehan)\
**Post date:** [8 February 2024 06:45 UTC](https://forum.confluent.io/t/source-connector-retrieve-the-current-task-count/10072/1 "2024-02-08T06:45:18Z")

</div>

I am writing a source connector. I want to programatically retrieve the current task.count, to add to the message header.  
This is used by a matching sink connector; which calculates the pipeline throughput based on tumestamps and the source connector task count. The current task count is a worker configuration - is it possible to access this? I prefer not to use the REST api or do anything to parse logfiles. I also need to retrieve the bootstrap.servers; so that the message header has provenance metadata about the (first) kafka cluster that the message was produced to,  
Is worker config accessible to a source connector?

---

<div class="post-metadata">

**Author:** ![Mark\_Teehan](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mark\_Teehan](https://forum.confluent.io/u/Mark_Teehan)\
**Post date:** [8 February 2024 11:53 UTC](https://forum.confluent.io/t/source-connector-retrieve-the-current-task-count/10072/2 "2024-02-08T11:53:37Z")

</div>

answering my own question:  
this.produceTaskName = MDC.get(“connector.context”);

sends the task name that did the produce. This is enough for me to work with; as I can count distinct task names in the sink.  
“produce.task.name=[halo-windows1-uploader|task-0]”

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [13 March 2024 11:11 UTC](https://forum.confluent.io/t/source-connector-retrieve-the-current-task-count/10072/5 "2024-03-13T11:11:23Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
