Friday 22 December 2017

Best way to communicate from a worker to web layer that work is done?

I've been having some fun doing Node-based setup employing workers and message queues to do stuff. I have a web process, essentially an API, that can receive calls and will, based on these, add work to be done to a queue. Workers consume the queue, doing the work. Now, in some cases, that's really all I need. Great. However, in other cases, I need the web process to show the new data when it's available. Before I do this part, I want to check if I've got the right idea for it. I want to know what the generally accepted best practice for this is.So far, what I believe should happen is this: Workers update some storage (cache/DB) that the web layer depends on, meaning all future data will be the updated data.I assume that a cache can be set to emit an event when a key's value changes to facilitate live-updating lists. I'm also in doubt if this is the best solution, if it's possible, so would love to hear what people have done/recommend.PS: This isn't very node-specific, for which I apologize. I just usually work in node, and didn't really know which other subreddit to go ask this question on, so here we are. :)

Submitted December 22, 2017 at 11:09AM by Maharyn

No comments:

Post a Comment