Getting Started with MQTT
Prerequisites
- Basic understanding of MQTT protocol
- MQTTX CLI installed
Step 1: Sign up
If you haven't signed up yet, you can sign up for free here: https://flowmq.io/auth/sign-up
Sign up with your email, GitHub, or Google account.
Step 2: Create a Project
Once logged in, you'll need to create your first project for free:
- Click Create your first project on the dashboard
- Enter a project name (e.g., "my-mqtt-app")
- Choose your preferred cloud platform and region
- Click Create
Your project will be provisioned within a few seconds. Once ready, you'll see your project dashboard with connection details.
Step 3: Set up Authentication Credentials
NOTE
FlowMQ Platform uses TLS and secure authentication for all connections.
To set up your credentials:
- In your project dashboard, navigate to Authentication
- Click Add Credential
- Enter Username and Password
- Click Create Credential
IMPORTANT
Save your password. The password will not be shown again for security reasons.
Step 4: Publish MQTT Messages
Let's use MQTTX CLI to publish messages to your FlowMQ project. See here to learn how to install MQTTX CLI on your system.
First, you need to get your project's connection details. In your project dashboard, navigate to Overview, you can get connection details there.
Publish messages with MQTTX CLI like below(replace the connection details with your FlowMQ project information):
IMPORTANT
Must use TLS and secure authentication to connect to your FlowMQ project.
mqttx pub \
-h your-project-id.flowmq.cloud \
-p 8883 \
-l mqtts \
-t t/1 \
--username your-username \
--password your-password \
--message 'Hello, FlowMQ!'Step 5: Subscribe to MQTT Messages
Start another terminal window, subscribe to MQTT messages like below(replace the connection details with your FlowMQ project information):
IMPORTANT
Must use TLS and secure authentication to connect to your FlowMQ project.
mqttx sub \
-h your-project-id.flowmq.cloud \
-p 8883 \
-l mqtts \
-t t/1 \
--username your-username \
--password your-passwordAfter subscribing successfully, publish more messages, you should see the subscriber receives all published messages.
Step 6: Persist MQTT Messages to a Stream
FlowMQ's unified architecture makes persisting your MQTT messages to a stream and consuming them by Kafka clients seamless than ever.
Let's create a stream:
- In your project dashboard, go to Streams
- Click Create Stream
- Enter Stream Name:
my-stream - Enter Topic Filters:
t/# - Click Create Stream
Now all MQTT messages published to topics matched by t/# will be automatically persisted to the stream my-stream. You can view the stream details in your dashboard.
Step 7: Consume Messages from Stream Using Kafka Client
After persisting MQTT messages to a stream, you can consume the messages using a Kafka client. This is perfect for batch processing, analytics, or data pipeline integration.
See Getting Started with Kafka to continue.
Next Steps
🎉 Congratulations! You've successfully:
- ✅ Created a FlowMQ project
- ✅ Set up secure authentication credentials
- ✅ Published and subscribed to MQTT messages using MQTTX CLI
- ✅ Persisted messages to a stream
What's Next?
- Explore FlowMQ Features: Learn about Unified Topics, Streaming, and Pub/Sub
- SDK Documentation: Explore language-specific guides in our MQTT SDK and Kafka SDK sections
Happy messaging with FlowMQ!