/
Custom Device Considerations

Custom Device Considerations

Here are some important considerations when developing your device.

  1. Don’t do ANY time consuming work in BaseDevice.Start() or BaseDevice.Stop(). There is a limit of 20 threads for Starting/Stopping devices. If you tie up one of these threads, there are fewer threads left for starting/stopping other devices. Without this cap, the server slows down and has difficulty starting channels because .NET generates too many threads.
  2. Use async/await where possible. This reduces the number of threads required by Connexion and results in better performance, and lower memory usage. This is especially important if the Connexion is running more than 100 channels.
  3. Prefer ProcessMessageAsync over ProcessMessage. Same as (2), but specific for processing messages. Also, ProcessMessage will be obsoleted in the next version of Connexion.
  4. Use BaseDevice.OnError to handle retrying. This uses async/await under the covers so there are no threads tied up sleeping. For an example of this please see: Sample Device with Retry (Sending)

Related content

Sample Device with Retry (Sending)
Sample Device with Retry (Sending)
More like this
Logging in Custom Devices
Logging in Custom Devices
More like this
Clearing Data On Export
Clearing Data On Export
Read with this
Error 6037
Error 6037
More like this
Runtime Value Storage
Runtime Value Storage
Read with this
Channel/Device URIs
Channel/Device URIs
More like this