# How to sink to kafka in flux engine?

**URL:** <https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440>\
**Category:** InfluxDB 2\
**Tags:** telegraf, kafka\
**Created:** [November 8, 2021, 7:16am UTC](https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440 "2021-11-08T07:16:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfnick](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/tfnick/32/8702_2.png) [@tfnick](https://community.influxdata.com/u/tfnick)\
**Post date:** [November 8, 2021, 7:16am UTC](https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440/1 "2021-11-08T07:16:25Z")

</div>

I try to use flux engine in influxdb2.0. The dataflow in my case is kafka → telegraf → influxdb2.0 → flux second process and store in influxdb and flux sink to kafka.  
But I found flux engine can not sink to kafka now(The  
old capacitor engine can do this).

I don’t want use kapacitor anymore and I think telegraf maybe another method for this purpose. So the question is :

Can I use telegraf for the dataflow as follow?

Kafka → telegraf(1) → influxdb2.0 → flux second process and store in influxdb → telegraf(2) → kafka

telegraf(1) convert data in kafka topic to influxdb’s table.  
telegraf(2) convert data in influxdb’s table to kafka another topic.

Thx for response.

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [November 8, 2021, 10:19am UTC](https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440/2 "2021-11-08T10:19:18Z")

</div>

Hi @tfnick ,  
So we have recently added the experimental [mqtt.to()](https://docs.influxdata.com/flux/v0.x/stdlib/experimental/mqtt/to/) function in Flux. We plan to add more IoT based protocols in the future. I will make sure to flag Kafka with product management. In the meantime what you could use to achieve your ends is [http.post()](https://docs.influxdata.com/flux/v0.x/stdlib/http/post/). You could then use the [http\_v2](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener_v2) input plugin via Telegraf. If this sounds good we can work on an example together.

---

<div class="post-metadata">

**Author:** ![tfnick](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/tfnick/32/8702_2.png) [@tfnick](https://community.influxdata.com/u/tfnick)\
**Post date:** [November 10, 2021, 10:26am UTC](https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440/3 "2021-11-10T10:26:16Z")

</div>

@Jay_Clifford  
Thanks u very much.  
In addition, I found kafka.to() method in flux’s source code.  
I try to use this method in influxdb2.0’s task. At present , it is running well.  
But the method kafka.to() is not available in the flux document, I don’t know why.

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [November 10, 2021, 10:35am UTC](https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440/4 "2021-11-10T10:35:23Z")

</div>

@tfnick ,  
Let me check with our product management team. Sometimes we preload experimental packages for testing before their official release. Looks like you got lucky and found the crystal skull before the map was made 😃 .

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [November 10, 2021, 10:57am UTC](https://community.influxdata.com/t/how-to-sink-to-kafka-in-flux-engine/22440/5 "2021-11-10T10:57:04Z")

</div>

> [@tfnick](#):
>
> I don’t want use kapacitor anymore and I think telegraf maybe another method for this purpose

Just my two cents: If you only _forward_ the data in influxdb/flux, I would rather do it right away in Telegraf.
