In the secure_mqtt.c snip, the MQTT publish and subscribe have used WICED_MQTT_QOS_DELIVER_EXACTLY_ONCE which is QOS 2. I was going through the RabbitMQ documentation and I found this link https://www.rabbitmq.com/mqtt.html where it is clear that the RabbitMQ MQTT Adapter does not support QOS2 in MQTT 3.1.1. So why did the mqtt_app_subscribe() work? In this blog http://www.rabbitmq.com/blog/2012/09/12/mqtt-adapter/ the author has stated that "While clients are permitted to request QoS 2 subscriptions, the adapter will only grant subscriptions up to QoS 1." This basically means that RabbitMQ downgrades the QOS 2 subscribers to QOS 1 that is why there was no error in mqtt_app_subscribe(). However, the author has said that "AMQP 0-9-1 does not define "exactly once" semantics for message delivery. For this reason the MQTT adapter does not support publishing messages at the QoS 2 (exactly once) level, or exchanging PUBREC, PUBREL or PUBCOMP messages with clients." This could probably be the reason why MQTT publish failed. Change the QOS in MQTT publish to QOS 1 and it should work correctly.