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

Hi Jaspar,

when you use the MQTTCLIENT_PERSISTENCE_DEFAULT persistence option, the persistence_context should be set to a directory to use.  That's it.  The persistence capability is all done for you, you don't need to make any calls to the persistence layer yourself.

The MQTTCLIENT_PERSISTENCE_USER option is provided if you want to use another persistence library.  Here is an example of using Redis (https://bugs.eclipse.org/bugs/show_bug.cgi?id=410419).  In that case, you would implement the persistence interface, but you still wouldn't make the actual calls yourself, that would still be done by the Paho library.

I hope that is a good explanation.

Ian

On 12/30/2016 10:29 AM, Jaspar LÃchte wrote:
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
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- Ian Craggs icraggs@xxxxxxxxxx IBM United Kingdom Paho Project Lead; Committer on Mosquitto