I am having some trouble with sending messages using MQTT on nRF9160DK. What I ultimately want to to is read UART and send whatever I receive to an MQTT broker. When running the mqtt_simple sample it is working as described at the fw-nrfconnect-nrf github repository, but when attempting to call data_publish() outside the mqtt_evt_handler() function it either does not send any data or the nRF9160 stops execution without any error messages. More specifically I am attepting to call data_publish() inside of the uart_cb() function from this example code.
I am using the PCA10090 0.8.2 version of the devkit with firmware version v1.0.0, NCS version v0.4.0 and v4.16 of SEGGER. I have also tried with firmware version v0.7.0.
Any and all help is greatly appreciated
Edit: Modified the original question slightly to reflect the actual problem I was having.