I’ll provide a comprehensive solution addressing all three focus areas for your MQTT provisioning challenge.
MQTT QoS Configuration:
To properly configure QoS levels in IoT Gateway Edge, you need to update the MQTT broker settings. Edit the gateway configuration file (typically /opt/iot-gateway/config/mqtt.properties):
mqtt.broker.maxQoS=2
mqtt.broker.qos.default=1
mqtt.provisioning.qos=2
This allows QoS 2 for provisioning while keeping default telemetry at QoS 1. Restart the gateway service after changes. However, be strategic about QoS 2 usage - it doubles the message overhead and can impact gateway throughput significantly at scale.
Gateway-Cloud Policy Alignment:
The gateway and cloud policies must be synchronized. In your SAP IoT cloud tenant configuration, verify the message service settings support QoS 2:
- Navigate to IoT Service Cockpit → Message Broker Configuration
- Set Maximum QoS Level to 2
- Enable Persistent Sessions for device connections
- Configure message retention policies to match your reliability requirements
Ensure firewall rules allow MQTT traffic on port 8883 (secure MQTT) with sufficient timeout values for QoS 2 handshakes. The four-way handshake requires longer connection windows.
Device Firmware Settings:
Your device firmware needs proper MQTT client configuration to work with QoS 2:
// Device MQTT client config
mqtt_config.qos = 2;
mqtt_config.clean_session = false;
mqtt_config.keep_alive = 60;
mqtt_config.message_timeout = 30;
Critically, set clean_session to false to enable persistent sessions. This ensures message delivery guarantees survive network interruptions.
Performance Optimization:
For your 500-device deployment, implement a hybrid QoS strategy:
- Use QoS 2 only for device provisioning and critical control messages
- Use QoS 1 for routine telemetry (temperature, pressure, etc.)
- Use QoS 0 for high-frequency, non-critical data (signal strength, diagnostics)
Update device firmware to select QoS based on message topic. This balances reliability with gateway performance.
Monitor gateway metrics after implementation: CPU usage, memory consumption, message latency, and connection stability. If you see degradation, consider scaling horizontally with additional gateway instances rather than compromising on QoS for critical messages.
Test the complete flow with a small device subset before full rollout to validate the policy alignment across all layers.