# Kafka to mqtt source connector 1:1 mapping for wild card topics

**URL:** <https://ask.lenses.io/t/kafka-to-mqtt-source-connector-1-1-mapping-for-wild-card-topics/286>\
**Category:** Apache Kafka Connectors\
**Tags:** kafka-connect\
**Created:** [August 28, 2024, 7:33am UTC](https://ask.lenses.io/t/kafka-to-mqtt-source-connector-1-1-mapping-for-wild-card-topics/286 "2024-08-28T07:33:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![THILAK](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/thilak/32/134_2.png) [@THILAK](https://ask.lenses.io/u/THILAK)\
**Post date:** [August 28, 2024, 7:33am UTC](https://ask.lenses.io/t/kafka-to-mqtt-source-connector-1-1-mapping-for-wild-card-topics/286/1 "2024-08-28T07:33:09Z")

</div>

I’m using the mqtt source connector to move data into kafka topics ,  
Im looking for way to autocreate topics with the same name as mqtt topics  
the connector would be a wildcard one something like Select \* from AUTO/+/+ OR AUTO/# AND SOMEHOW I WANT TO CREATE MULTIPLE KAFKA TOPICS with the same name as the MQTT topics , i tried using the sql processor after inserting everything into a TOPIC and then later grouping them based on field and inserting only grouped messages into a different topic but i cant seem to use the topicname from the field or any way iterate over the grouped by values

heres a stcakoverflow question referencing something similar:

> <https://stackoverflow.com/questions/66303101/kafka-connect-mqtt-is-it-possible-to-have-a-11-map-between-mqtt-and-kafka-topi>

my connector config:  
connector.class=com.datamountaineer.streamreactor.connect.mqtt.source.MqttSourceConnector  
connect.mqtt.username=user  
name=src-connector  
connect.mqtt.kcql=INSERT INTO SametopicnameasmqttTOPIC SELECT \* FROM AUTO/+/+  
value.converter=org.apache.kafka.connect.converters.ByteArrayConverter  
connect.mqtt.service.quality=1  
connect.mqtt.password=\*\*\*\*\*\*  
key.converter=org.apache.kafka.connect.json.JsonConverter  
connect.mqtt.hosts=tcp://MQTTHOST:1883

---

<div class="post-metadata">

**Author:** ![stheppi](https://dub1.discourse-cdn.com/flex017/user_avatar/ask.lenses.io/stheppi/32/30_2.png) [@stheppi](https://ask.lenses.io/u/stheppi)\
**Post date:** [September 2, 2024, 10:59am UTC](https://ask.lenses.io/t/kafka-to-mqtt-source-connector-1-1-mapping-for-wild-card-topics/286/2 "2024-09-02T10:59:16Z")

</div>

Hi Thilak,

At the moment there is no such support.

There are two approaches you can take, both involves writing code. One is using the connector support for its own converters (see [MQTT to Kafka open source connector | Lenses.io Documentation](https://docs.lenses.io/5.5/connectors/sources/mqttsourceconnector/#message-converters) and the WITHConverter) which allows to create the output Connect framework record.

The second one is to write your own SMT for a source record, and use the SourceRecord.sourcePartition Map and look for the key named: `topic`. This might be less complex to write and deploy than the first option.

Regards,  
Stefan

One thing to keep in mind is that MQTT topics/queue names might not match the Kafka topic name restrictions, and you should account for that in your implementation.
