Agent and device communication

Hi,

I would like to know how the agent and device execution flow is affected when
multiple simultaneous device.on / agent.on messages are received.

Will each request will spawn a thread ?
or
Will the messages be queued ? and If this is the case what happens to agent/device queues on agent/device restart?
or
Is their a possibility of messages getting dropped ?

Also does the behavior changes when device/agent is busy vs idle ?

The squirrel (on both agent and imp) is single threaded, so messages are processed in the order they were received. Each handler has to complete execution before the next one starts.

Messages can be dropped if an imp is not online, or if the buffers fill to an excessive degree (eg if an imp is sending to the agent too fast, this can drop messages, but you really have to be processing data very slowly on the agent). We do not queue these as whatever queuing semantic we come up with may not suit the application and end up causing trouble.

The Bullwinkle framework may well help you here: https://github.com/electricimp/bullwinkle