I want to create a queue where clients can put in requests, then server worker threads can pull them out as they have resources available.
I'm exploring how I could do this with a Firebase repository, rather than an external queue service that would then have to inject data back into Firebase.
With security and validation tools in mind, here is a simple example of what I have in mind:
- user pushes a request into a "queue" bucket
- servers pull out the request and deletes it (how do I ensure only one server gets the request?)
- server validates data and retrieves from a private bucket (or injects new data)
- server pushes data and/or errors back to the user's bucket
A simplified example of where this might be useful would be authentication:
- user puts authentication request into the public queue
- his login/password goes into his private bucket (a place only he can read/write into)
- a server picks up the authentication request, retrieves login/password, and validates against the private bucket only the server can access
- the server pushes a token into user's private bucket
(certainly there are still some security loopholes in a public queue; I'm just exploring at this point)
Some other examples for usage:
- read only status queue (user status is communicated via private bucket, server write's it to a public bucket which is read-only for the public)
- message queue (messages are sent via user, server decides which discussion buckets they get dropped into)
So the questions are:
- Is this a good design that will integrate well into the upcoming security plans? What are some alternative approaches being explored?
- How do I get all the servers to listen to the queue, but only one to pick up each request?