I don’t think that Firebase cloud functions should make an obsolete firebase queue obsolete, and I don’t think it’s at all illogical to want to combine a firebase queue with cloud functions, as @@ Frank van Puffelen said.
Firebase-queue provides much more than a way to complete tasks for firebase and startup tasks. It provides a protocol for communication between parties assigning and responding to task requests, coordinates repeated attempts of unsuccessful tasks, and reports on progress, status, and additional metadata. One of the things this allows is task chains.
I think it would be helpful if Firebase or a third-party developer developed a firebase-functions-queue package that extends the firebase functions and allows you to write a firebase cloud function with the same signature as the firebase queue. Something like that:
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 will work the same as firebase-queue and use the same metadata and parameters, except that it will not need to manage multiple workflows, since cloud functions already do this automatically and smoothly.
This will have the following advantages:
- Allows firebase developers to use the standard way to schedule tasks, monitor progress, failure, etc.
- An application can schedule a queue job and does not care if it is being processed by a cloud function or other environment.
- A developer could take an existing queue and transfer it from the node server to the cloud functions without changing the client application.
- It may even allow a task chain when one task can be handled by a cloud function and the other by another server as part of the same job.
jjjjs
source share