Search code examples
kaa

Kaa has heart-rate mechanism for all endpoints?? Will Kaa kick off one endpoint automatically?


An endpoint connect to the Kaa server and subscribe some topics. In normal condition, KaaClient's unsubscribeFromTopic() & stop() method will be called before disconnect the Kaa server.

In some cases, the endpoint maybe disconnect the Kaa server suddenly and won't re-connect to Kaa server immediately (ex: loss power...).

If an endpoint disconnect the Kaa server without call the unsubscribeFromTopic() & stop() method, the resource will still be occupied?? If yes, the Kaa server has heart-rate mechanism for all endpoints?? Will Kaa server kick off one endpoint automatically if it can detect the endpoint has disconnected exceed over a period time??


Solution

  • Short answer is yes, Kaa will free resources once no active connections are present. There is a ping-pong mechanism to track session inactivity. Inactivity timeout that will be used is configurable. See this configuration file for more details.

    Extended answer: Kaa uses actor system based on Akka framework to handle endpoint requests/sessions. Each Endpoint has associated Endpoint Actor (actually, there are at least two of them, one on the node that handles endpoint session and one global actor for particular endpoint in the Kaa cluster). This actors schedule timeouts once no active sessions is available.