如何在Firebase中动态创建Cron作业

编程入门 行业动态 更新时间:2024-10-25 02:30:28
本文介绍了如何在Firebase中动态创建Cron作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有人知道如何使用Firebase动态设置Cron Jobs吗?我想构建一个规则引擎,客户端可以使用该引擎指定规则,操作和计划,并基于此我需要计划该特定规则。由于计划由客户掌握。我可以为作业设置一个预定义的频率。

Does anyone know how can I set up Cron Jobs dynamically with Firebase? I want to build a rule engine using which the Client can specify the rules, actions, and schedule and based on that I need to schedule that particular rule. Since the scheduling is in the hand of the Client. I can set a predefined frequency for the JOB.

我知道在Node.js中我可以使用 node-schedule之类的库来实现。但是由于客户严格希望使用Firebase和Angular。我不能使用该解决方案

I know in Node.js I can do it with libraries like "node-schedule". But since the Client strictly wants to use Firebase and Angular. I can't use that solution

推荐答案

没有办法仅靠Cloud Functions动态创建计划功能。

There is no way to dynamically create schedule functions with just Cloud Functions.

两种最常见的方法是:

  • 具有定期调度的云功能(例如每分钟),然后从数据库中读取任务,并执行启动的任务。
  • 使用具有API的单独计划程序服务来创建计划,例如Cloud Tasks。道格在如何安排Cloud Function在将来与Cloud Tasks一起运行(以构建Firestore文档TTL)。 / li>
  • Have a regularly scheduled Cloud Function (say every minute) that then reads the tasks from a database, and executes the tasks that are up.
  • Use a separate scheduler service that has an API to create schedules, like Cloud Tasks. Doug wrote a great article about that in How to schedule a Cloud Function to run in the future with Cloud Tasks (to build a Firestore document TTL).

另请参见:

  • 如何在firebase中以编程方式创建cron作业
  • How to create cron jobs in firebase programmatically

更多推荐

如何在Firebase中动态创建Cron作业

本文发布于:2023-10-25 08:06:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1526408.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   动态   如何在   Firebase   Cron

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!