Connecting MQTT proxy to Apache kafka cluster in confluent cloud

Hello,
I created a kafka cluster through the confluent cloud website, i’m trying to connect it to MQTT proxy through Confluent CLI but when i launch the command to start mqtt proxy i keep getting this error :

I feel like i’m missing something in my kafka-mqtt-dev.properties but i don’t know what exactly. this is my dev.properties file :

topic.regex.list=temperature:.*temperature, brightness:.*brightness
listeners=0.0.0.0:1883
bootstrap.servers=PLAINTEXT:// here i have my Bootstrap server link !
confluent.topic.replication.factor=1

thank you

hi @Oussgasmi

welcome to the forum :slight_smile:

having a quick look it seems that your config is missing the authentication settings to connect to confluent cloud.

details are here:
https://docs.confluent.io/platform/current/kafka-mqtt/security-settings.html

hth,
michael

hello again :wink:

here are the relevant settings which need to be added to your config file


# bootstrap server url
bootstrap.servers=$yourcluster.aws.confluent.cloud:9092

# security protocol
producer.security.protocol=SASL_SSL

# sasl mechanism
producer.sasl.mechanism=PLAIN

# sasl jaas config
producer.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule   required username='api_key_from_confluent_cloud'   password='api_secret_from_confluent_cloud';

# confluent cloud refuses to create topic if you use default replication factor of 1
confluent.topic.replication.factor=3

1 Like

It worked ! thank you. i have a last question if you don’t mind, is there any solution to implement MQTT proxy on the cloud ? because for the moment everything i’m using is on cloud except for the mqtt proxy that i start from my machine.
thank you in advance

perfect :slight_smile:

hivemq cloud might be the right solution. at least there is a free version to try (some data limits)

and also a blog post about a possible setup

hth,
michael

1 Like

Ok thank you !
And can i use the Postgres sink connector to send my data to a Timescaledb database ?

yes, should be possible

thank you so much for your time and energy! I know that i’m asking too many questions but i’m new to this. but this is the last one : so I saw that in order to transfer my data from my cluster to the database through the connector, i need to set a message value schema.
the data that i’m supposed to get from my Iot devices is a json string in this form :
{
“MachineName”: “machine1”,
“timestamp”: 12456789,
“speed”: 100,
}
How can i configure my schema to get this time of message, because i tried to do one and keep getting null values in messages received by the topic.
Thank you in advance

did this some time ago, need to check my docs
basically defining a schema might be the best

some docs around schema registry
https://docs.confluent.io/platform/current/schema-registry/schema_registry_ccloud_tutorial.html#schema-registry-ccloud-tutorial

here are some information which might help

best,
michael

1 Like