UI have an odd throttling requirement

26 views
Skip to first unread message

Nico Braun

unread,
Oct 13, 2024, 4:04:32 PMOct 13
to nats
Hi,

I am currently designing a system to event source and process IOT device readings, from approximately 200k devices. Each of those will send readings from a set of serveral thousand possible parameters.

The devices use a custom protocol, so I need to run some type of relay server, to get the events onto and of off nats.

The connection between IOT device is a long lasting TCP Connection.

I need to be able to read and send messages to the IOT devices, though their current connection.

Now, I have the requirements:

    - each nats client, holds multiple device connections  

    - send only 1 message to a device at a time, and wait for the response, before sending the next one.

    - device can send another message other than the pending response while waiting.

    - It is only possible to know if a given device message is the pending response, by inspecting its payload.

----

I hope this makes sense. 

I am not entirely sure how to solve this. I am thinking of some way to queue a pending response and block further reads for that specific connection. 

I cannot simply block all reads until next message is read. Even if I could, how do I efficiently prevent the nats client to consume the message for that device, if it currently has a pending response open. The nats client needs to read messages for other devices, so it cant simply stall completely.

Nico




Reply all
Reply to author
Forward
0 new messages