Quality RTOS & Embedded Software


coreMQTT Agent
Thread-safe MQTT C client library for small IoT devices (MCU or small MPU)


The coreMQTT Agent library is a high level API that adds thread safety to the coreMQTT library. It lets you create a dedicated MQTT agent task that manages an MQTT connection in the background and doesn't need any intervention from other tasks. The library provides thread safe equivalents to the coreMQTT's APIs, so it can be used in multi-threaded environments.

The MQTT agent is an independent task (or thread of execution). It achieves thread safety by being the only task that is permitted to access the MQTT library's API. It serializes access by isolating all MQTT API calls to a single task, and it removes the need for semaphores or any other synchronization primitives.

The library uses a thread safe messaging queue (or other inter-process communication mechanism) to serialize all requests to call MQTT APIs. The messaging implementation is decoupled from the library through a messaging interface, which allows the library to be ported to other operating systems. The messaging interface is composed of functions to send and receive pointers to the agent's command structures, and functions to allocate these command objects, which allows the application writer to decide the memory allocation strategy appropriate for their application.

The library is written in C and designed to be compliant with ISO C90 and MISRA C:2012. The library has no dependencies on any additional libraries other than coreMQTT and the standard C library. The library has proofs that show safe memory use and no heap allocation, so it can be used for IoT microcontrollers, but is also fully portable to other platforms.

This library can be freely used and is distributed under the MIT open source license.


Code Size of coreMQTT Agent (example generated with GCC for ARM Cortex-M)
FileWith -O1 OptimizationWith -Os Optimization
Total estimates8.9K7.4K

Memory Estimation includes coreMQTT library
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.