PublishQueueExtRK Error

I’m trying to implement the PublishQueueExtRK. I have a Boron using 6.3.3 the following are some snipes of code I am using. When I add PRIVATE | WITH_ACK I get compile error. When I take out and run without PRIVATE | WITH_ACK I don’t actually publish any data. Not sure what is going on but my setup may be incorrect?

#include <PublishQueueExtRK.h>

//setup

PublishQueueExt::instance().setup();
PublishQueueExt::instance().withFileQueueSize(25); //
PublishQueueExt::instance().withDirPath("/usr/myqueue");
PublishQueueExt::instance().withPublishCompleteUserCallback(publishCompleteHandler);

then in loop:

case SAMPLE_STATE_INT:

PublishQueueExt::instance().loop();

then when I send data I use:

PublishQueueExt::instance().publish("xyz-HOOK", xbuf, PRIVATE | WITH_ACK);

but currently when I add PRIVATE | WITH_ACK i get compile error:

no matching function for call to 'PublishQueueExt::publish(const char [9], char [185], particle::Flags<PublishFlagType, unsigned char

also in my callback it looks like:
Void publishCompleteHandler(const CloudEvent &event) {
    Log.info("Publish complete: name=%s, data=%s, result=%d");
    
     dataInFlight = false;    // Data has been received
     //waitUntil(meterParticlePublish);
   
    if (debug){
       blinkLED2(); 
    }
	
        
}

Leave out the last parameter. All events are private now, and when using CloudEvent, all events are WITH_ACK, so there’s no option.

Thanks Rick that fixed my problem..one other thing is I read you can publish quicker than1 per second is that true? Also just to clarify if I am connected to the network when I execute bool bResult = PublishQueueExt::instance().publish("xyz-HOOK", xbuf); the publish happen normally, if the network is off line then the xbuf will get written to memory/disk. Normally I do a check like

if (Particle.connected())(

bool bResult = PublishQueueExt::instance().publish("xyz-HOOK", xbuf);

}else{

error

}

so it sounds like I don’t need to check for Particle.connected anymore before I publish.

Thnks

Correct. When using the PublishQueueExtRK library you can publish as fast as you want, subject to available flash file system space. The library will meter it out at the appropriate rate, which is roughly that no more than 32K of data can be in transit at a time.

You can safely publish while offline when using the library publish methods, but it can’t be before the library setup method is called.

That’s kinda the way I thought it would work.. for some reason when I try to publish faster then 1 second it seem to always miss one. What should I look at to see why this would happens.

Each time I publish is about 125 bytes per publish (when I test publish 3 consecutive time only 2 ever get published within about 1.5 second), even though I am connect to the network at all times.

It does work when I go slower.

Any thoughts were I should look?

Do you have this call in your global loop()? It’s required for deferred publish to work:


PublishQueueExt::instance().loop();

Turning on logging and capturing a USB serial debug log is the best option to debug:

SerialLogHandler logHandler(LOG_LEVEL_INFO, { // Logging level for non-application messages
	{ "app.pubq", LOG_LEVEL_TRACE },
	{ "app.seqfile", LOG_LEVEL_TRACE }
});

I made some changes in my code and that seem to fix the issue. Thanks for your help

1 Like