Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Persistence (C Language)

Hello there,

I don’t know, if this is the “right” place to get help for using MQTT Paho.

I am doing some research on persistent messaging with MQTT. I use the open source Mosquitto Broker in combination with MQTT-Paho for C language.

I just set up a publisher (able to publish various messages on a topic) and a subscriber (to receive them). 

Now I wanted to get persistence mode. I tried to figure out how to use the functions from the MQTTClientPersistence.h Header.

There is no example for using persistence header. I thought I need to use the client, then I thought about a void pointer.
The other thing I am not sure about is, what to use as a persistence type?
If I use MQTTCLIENT_PERSISTENCE_DEFAULT the paho script is doing everything for me and I dont need to open an own PersistenceClient? And for MQTTCLIENT_PERSISTENCE_USER I need to set up everything on my own? (with opening, and saving messages and all the stuff?)

What ever I try, I get SIGSEGV in the Persistence_open function.

void* handle;
MQTTClient client;
MQTTClient_persistence persist;
MQTTClient_create(&client, config->host, config->cid, MQTTCLIENT_PERSISTENCE_DEFAULT, dir);

// some connection options …

//persist.popen((void**)&handle, config->cid, config->host, dir);
persist.popen(&client, config->cid, config->host, dir);

Thank you

Jaspar Löchte

Back to the top