实现基于文件的队列 [英] Implementing a file based queue

查看:298
本文介绍了实现基于文件的队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内存有界的队列,其中有多个线程排队对象。通常,队列应该由处理队列中项目的单个读取器线程清空。

I have an in memory bounded queue in which multiple threads queue objects. Normally the queue should be emptied by a single reader thread that processes the items in the queue.

但是,队列可能已填满。在这种情况下,我想在磁盘上保留任何其他项目,这些项目将由另一个后台读取器线程处理,该线程扫描目录中的这些文件并处理文件中的条目。我熟悉Active MQ,但更喜欢更轻量级的解决方案。如果没有严格遵循FIFO,则可以(因为可以不按顺序处理持久化的条目)。

However, there is a possibility that the queue is filled up. In such a case I would like to persist any additional items on the disk that would be processed by another background reader thread that scans a directory for such files and processes the entries within the files. I am familiar with Active MQ but prefer a more light weight solution. It is ok if the "FIFO" is not strictly followed (since the persisted entries may be processed out of order).

那里有没有开源解决方案?在我自己开始实施之前,我没有发现任何但我认为我会在此列表中查找建议。

Are there any open source solutions out there? I did not find any but thought I would ping this list for suggestions before I embark on the implementation myself.

谢谢!

推荐答案

你可以使用像SQLLite这样的东西来将对象存储在。

You could use something like SQLLite to store the objects in.

这篇关于实现基于文件的队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆