Is there a good open-source MongoDB Queue Implementation for the C# Driver

£可爱£侵袭症+ 提交于 2019-12-12 16:26:12

问题


Not that it wouldn't be easy (or fun) enough to write one, it makes sense not to re-invent the wheel so to speak. I've had a look around at various attempts, but I don't seem to have yet come across an implementation that supports these criteria;

Simple queue OSS system with MongoDB persistence;

  • C# Driver (official) based (so full POCO serialization)
  • Tailable cursors rather than polling
  • handles message timeout (GC correctly)
  • handles consumer failure (ideally crash detecting re-insertion, but timeout with delayed re-insertion is fine) so findAndModify on complete
  • multiple writers, multiple consumers
  • threadsafe

Nice to have;

  • allows for (latest only) message (replace older messages in the Q)

If anyone has nice simple a library like that floating around on GitHub that I've not yet found, please speak up!


回答1:


There's my little project - a .net message bus implementation that works with MS SQL queues or MongoDB (MongoDB support is a recent addition). Link: http://code.google.com/p/nginn-messagebus/ and http://nginn.org/blog for some examples. I'm not sure if this is what you're looking for, it's also lacking in documentation and example departments and it doesn't exactly match your specs (polling instead of tailing) - but maybe it's worth giving a try. This is a publish-subscribe message bus, like NServiceBus or MassTransit - not a raw message queue.

PS I'm afraid there are mutually exclusive requirements in your specs: you can't use tailable cursor with concurrent consumers because you lose atomicity. If you want to tail a queue you should use only a single consumer.



来源:https://stackoverflow.com/questions/12269503/is-there-a-good-open-source-mongodb-queue-implementation-for-the-c-sharp-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!