firebase-queue icon indicating copy to clipboard operation
firebase-queue copied to clipboard

Firebase-queue for Cloud Functions

Open jaufgang opened this issue 8 years ago • 6 comments

I am basing this issue on a question I came across on StackOverflow regarding whether or not cloud functions render firebase-queue obsolete, and my answer to that question. Also, I noticed that the Readme.md of this project has been changed to point developers away from this library in favour of cloud functions.

Firebase-queue provides much more than a way for tasks to listen to firebase and launch tasks. It provides a protocol for communication between parties assigning and and responding to task requests, coordinating retries of failed tasks, reporting progress, state and additional metadata, and task chaining.

I think it would be useful for Firebase to develop a firebase-functions-queue package that extends the firebase-functions package and allows you to write a firebase cloud function with the same signature as firebase-queue. Something like this:

const functions = require('firebase-functions');
const functions-queue = require('firebase-functions-queue'); //extends firebase-functions with onQueue function

admin.initializeApp(functions.config().firebase);

functions.database.ref('/queue').onQueue(options,function(data,progress,resolve,reject){
    ...
    })

This new package would work just like firebase-queue and use the same metadata and options, except it wouldn't need to deal with managing multiple worker processes since cloud functions already do this automatically and seamlessly.

This would have the following advantages:

  • Would allow firebase developers to use a standard way of assigning jobs to queues, monitor progress, failure, etc.
  • An app could assign a job to a queue and not care if it was being handled by a cloud function or a different environment.
  • A developer could take an existing queue and move it from their node server to cloud functions without changing the client app.
  • It could even allow task chaining where one task could be handled by a cloud function and another by a different server within the same job.

jaufgang avatar Mar 13 '17 12:03 jaufgang

@drtriumph @nicolasgarnier fyi

katowulf avatar Mar 13 '17 18:03 katowulf

another advantage is having a queue running on a local server that uses platform specific libraries that aren't supported on Cloud Functions

chalber avatar Mar 16 '17 18:03 chalber

I agree with this. Have ended up just doing my own implementation instead of using queue

prescottprue avatar Mar 17 '17 20:03 prescottprue

This is interesting to me. I've done a few projects with firebase now and really like firebase-queue. I recently learned about functions and am curious how I can use it similarly and in combination with pub/sub to eliminate a dependency on amqp.

alexanvl avatar Apr 09 '17 00:04 alexanvl

I am also interested in something like this and am sad to have not heard anything from the developers of this repository. firebase-queue offers a lot more than firebase functions and being able to deploy them to Firebase would be great.

incognitojam avatar Dec 22 '17 15:12 incognitojam

@jaufgang I just released a trimmed down version of firebase queue: https://github.com/kaliberjs/firebase-queue

It is a lot more lightweight, has less moving parts, no dependencies and a more modern approach (promises).

I am not sure what would be needed to support Firebase Functions, but if you look at the code you will see that it is probably pretty doable. I personally have no experience with Firebase Functions, but I think if there is enough demand and interest we can pull something off.

EECOLOR avatar Jul 29 '18 22:07 EECOLOR