Sync job queue with async feed


#1

Hello everyone,
I am fairly new to rustlang, but it is offering some interesting concepts.
The plan is it to feed data into a queue, which is processed sync. I receive the data with async TCP server via Tokio-Core and -IO. I want to know which concept is the best to “enqueue” my queue sync in Rust and process the data successively. The fed data are parameters for a “method” running on core too.

I would love to see some help here. In fact, this whole Rust and Future thing is completly new to me. I try to understand it by doing.
Oh, if there a information missing, please write it. I will pass it then.
Best regards
Christopher


#2

Well, I don’t know if I got you right, but I would do it as follows:

Create a channel and pass the RX to the queue (running in a separate thread). The Tokio receiver will get the TX and send everything through the channel to your “working queue”.

See https://doc.rust-lang.org/std/sync/mpsc/


#3

Yes, this was exactly I was looking for. Thank you very much. The next time I will use google better than I did.