Events for Cores online / offline?

hi guys,

1: Is there any possible to fire a Offline-Event from Spark Server when the the Core catch a offline ?

2: How to publish the event inside the code when the Core in case of offline, the event will be lost or send until it is online?

3: On the other hand, For the Server sent events(SSEs), will also face to the same problem,
event from server should be cached on the cloud side? and send when the cores being online?

4: Suppose, there are lots of Cores in a system ,then, it will have a platform to monitor the real time staus(offline/online) of those Cores, if one Core got offline ,system will give an Alarm out to the Managers. then how to implement it, we need make a backend job to loop call api to fetch the Coresā€™s status continually?

thanks your readingā€¦

Hi @yuanetking,

Good question! Iā€™ve been thinking about this a bit lately.

1.) Iā€™ve been thinking about adding this, what does everybody think?

2.) The core canā€™t send events when itā€™s offline, I believe theyā€™re simply dropped in the meantime.

3.) The publish function has a ttl param that is meant to represent how long the event will ā€˜liveā€™ on the server before itā€™ll be discarded, we donā€™t use it yet, but we will for queuing / caching old events.

4.) Totally! I think a system supported ā€œonline/offlineā€ state event might be useful. The online part is easy to do in your firmware, but the offline part would need to be server side. I think Iā€™d want to do both server side for consistency.

Thanks,
David

1 Like

hi @David , thanks your reply, and Sorry for my english :smile:

Maybe one thing didnt consider,Suppose, If one core is calling ā€œSpark.publish()ā€ but the current core is offline , then the event will not be cached into the Spark Cloud, the event will be lost, So , the locally firmware event cache is also needed, i think.

ttl will not be reliable , cosļ¼Œ any preset of reserving time may not meet the customerā€˜s requirment sometimes, it is unpredictable.

Adding the online/offline mechnism will bring more complex to the system. The reason i like Spark is because that we have the same idea, See The blog from @zach http://blog.spark.io/2014/07/22/letter-from-the-ceo/ , But , I think of the key feature of the Distributed OS will be the Online/Offline event mechnism, as the network enviroment will be unpredictable (This is differ to the traditional OS like, windows, etc)

BTW, did u face to the problem about how to Identify Offline Event (hardware could not do anything when it got offline, So it will not be identified immediatly by Cloud Side )? Normally, Identified it by monitor the heardbeat. , but it will bring us scores of seconds time delayā€¦ In my previous distributed System , i used JMS(ActiveMQ) implementation(0 times delay) , but i am not exactlly know how they did . maybe you can refer to it .

Thansk.
Chris.

A quick response to an API request for the connected state would be nearly as valuable as an event.

This functionality is important for power consumption issues as well as othersā€¦

The status of a core can be polled, when itā€™s up, an app can pull data or send control messages then let the core power down. the quicker the response to the online condition the longer the battery life.

For server side applications, an event (web hook) would work nicely. For other applications, not server based, a polling API would be best.

1 Like

I got a nice reply on a different thread related to this one. Iā€™m told if we signal disconnect from the core, the response will be quick on the device status. The problem is that when a core just looses connection, like power being cut, it never tells the server and a long timeout process happens when we do a request.

This should not be a problem for cores that are being put to sleep as they do signal the serverā€¦

Am I right?