Suppose you want to submit some data to a queue (RabbitMQ, in this case) when something is posted to a route. What would be the best way of going about this?I'm looking for anything, really, even just suggestions. I don't even feel like I've been searching for the right things. What I've done so far, because it's really all I know how to do, is to connect RabbitMQ (docker container) on each endpoint hit, and submit the job. As long as this is just a hobby project, that's fine, I guess. But suppose I wanted to build something production-quality like this one day.I feel like I should have an established connection that I could pass the job to for submission, but I'm unsure of how to properly do this without spawning a worker process to handle it for me, which I really don't want to do. Largely, I suppose, because most of my jobs have involved relatively small projects that run in single-core environments, so spawning a child process will only eat into the web process' available power. Even if only slightly. But, on the other hand, it's currently the only way I can think of, other than to do what I'm doing, which is connecting to the queue on every request.Would really appreciate some input, or just some hints at what I should ask google about to get more knowledge about how to approach this.
Submitted January 30, 2018 at 05:17PM by Maharyn
No comments:
Post a Comment