过程中的cron Job -sidekiq

发布于 2025-02-05 03:27:36 字数 290 浏览 2 评论 0原文

我有一个Ruby在Rails应用程序上,可以从Twilio接收Webhooks,我不想立即处理这些Webhooks。我想要的是:

  • redis队列中的编号webhooks
  • 计划在特定间隔后从队列中获得工作,并根据某种条件处理这些
  • 工作,这将在特定的间隔后处理作业,我将能够控制玉米工作来处理工作。

该应用程序已经具有与Redis的Sidekq的工作设置,但是我找不到进入玉米作业的方法和以后执行的方法。

关于如何实现上述功能的任何建议?非常感谢您提供的任何帮助。

I have a Ruby on Rails application that receives webhooks from Twilio, I don't want to process these webhooks immediately. What I want is:

  • Enqueue webhooks in the Redis queue
  • Schedule a cron-job to get jobs from the queue after a specific interval and process them based on some condition
  • This will process jobs after specific intervals and I will be able to control the frequency of corn jobs to process jobs.

The application already has a working setup of Sidekiq with Redis, but I'm unable to find a way to enqueue jobs and perform later with the help of corn job.

Any suggestions on how I can achieve the above functionality? I really appreciate any help you can provide.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿港巷口少年归 2025-02-12 03:27:36

您可以尝试以下方法:

  • 创建一个新模型,例如,将数据发布到您的Webhook上,可能带有标志来指示是否已处理。
  • 每当数据到达时,创建一个模型的新实例,然后保存到数据库
  • 计划CRONJOB中,以获取一个任务以获取所有未经处理的Twiliorespsess实例并处理它们,这可能会移至Sidekiq或在任务中直接处理
  • twiliorpsess模型,设置为处理的标志

You can try this approach:

  • Create a new model for example TwilioResponse that holding the data posting to your webhook, probably with a flag to indicate if it has been processed.
  • Whenever data coming, create a new instance of that model and save into the database
  • Schedule cronjob for a task to grab all unprocessed TwilioResponse instances and process them, this maybe moved to Sidekiq or just process directly in the task
  • After process a TwilioResponse model, set the flag to processed
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文