简体   繁体   English

如何将Node.js用于队列处理应用

[英]How to use node.js for a queue processing app

将node.js用于队列处理应用程序时的最佳实践是什么?

My main concern there would be that Node processes can handle thousands of items at once, but that a rogue unhandled error in any of them could bring down the whole process. 我主要担心的是,Node进程可以一次处理数千个项目,但是其中任何一个流氓未处理的错误都可能导致整个过程中断。

I'd be looking for a queue/driver combination that allowed a two-phase commit (wrong terminology I think?), ie: 我正在寻找允许两阶段提交的队列/驱动程序组合(我认为这是错误的术语?),即:

  1. Get the next appropriate item from the queue (which then blocks that item from being consumed elsewhere) 从队列中获取下一个适当的项目(然后阻止该项目在其他地方使用)
  2. Once each item is handed over to the downstream service/database/filesystem you can then tell the queue that the item has been processed 将每个项目移交给下游服务/数据库/文件系统后,您可以告诉队列该项目已被处理

I'd also want repeatably unique identifiers so that you can reliably detect if an item comes down the pipe twice. 我还需要可重复的唯一标识符,以便您可以可靠地检测到某项是否两次落入管道。 In a theoretical system it might not happen, but in a practical environment the capability to deal with it will make your life easier. 在理论上,这可能不会发生,但是在实际环境中,处理它的能力将使您的生活更轻松。

查看http://learnboost.github.com/kue/我已经将其用于几个宠物项目,并且效果很好,您可以查看其来源并检查他们采取了哪些措施

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM