Closed fgadaleta closed 2 years ago
Hi @fgadaleta,
I understand that you want to use different threads to process different events coming from ´for_each, right? From the
nodeAPI I think you couldn't since once you call
for_each` you are tied with the thread who called it. Maybe you could copy those events and process them later in your thread pool although this would imply copying the message data.
The node
API is no more than a wrapper along the NetworkController
and the NetworkProcessor
to handle it more easily. I think that using directly those entities you can archive what you want because you have more control. You can see an example of using it directly in benches/latency.rs
(latency_by()
and init_connection()
functions).
I'm glad message-io is added to your services 😃
I think I solved by wrapping the typical .run()
method (from the distributed discovery server example) into a thread and seems to work.
Now that all services are running in separate threads (and message-io is one of them), it's time to play with different transport protocols - which i find extremely well done :)
Great! 😃 I hope it is useful for your project.
Any problem do not hesitate to ask
Thank you so much! It'll be great
Is there a way to put the loop
node_listener.for_each(move |event| match event.network() {...
in a thread pool?My application is already spawning threads for services and
message-io
would be one of such services.