FirebaseExtended / firebase-queue

MIT License
787 stars 108 forks source link

Firebase-queue for Cloud Functions #115

Open jaufgang opened 7 years ago

jaufgang commented 7 years ago

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:

katowulf commented 7 years ago

@drtriumph @nicolasgarnier fyi

chalber commented 7 years ago

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

prescottprue commented 7 years ago

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

alexanvl commented 7 years ago

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.

incognitojam commented 6 years ago

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.

EECOLOR commented 6 years ago

@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.