Separate processing from reading and sending data
Processing blocks the input channel handler. Although the processing takes only 20 ms, it is enough for the trains to be dropped downstream. To improve performance the reading, processing and sending of data should be split in the separate routines running in parallel. While one train processing the channel is ready to read next train.