GithubHelp home page GithubHelp logo

persi12 / trivialmongomessagequeue Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrevdm/trivialmongomessagequeue

0.0 1.0 0.0 2.11 MB

Simple .net message queue built on MongoDB

Home Page: http://andrevdm.blogspot.com/search/label/TmMq

License: Other

C# 100.00%

trivialmongomessagequeue's Introduction

TmMq

TmMq - Trivial MongoDB Message Queue is a very simple .net message queuing system built on MongoDB

It is not in any way meant to compete with any of the fully fledged messaging solutions (Hortet, ActiveMQ etc) but it is a nice, lightweight alternative that has proved useful to me.

Features

  1. No TmMq server
  2. Send & receive
  3. Publish / subscribe
  4. Redeliver on error with limit on retry
  5. Limit on delivery (at-least-once delivery)
  6. Message expiry
  7. Message holding (only deliver in future)
  8. Errors logged in message
  9. Dynamic properties collection
  10. Synchronous and asynchronous receive
  11. Written in C#

TODO

  1. Triggers based on tailable MongoDB cursor. I'm not sure this is necessary, I will implement it if I find I need it.
  2. More unit tests

Licence

FreeBSD License. See licence.txt

Usage

See the unit tests for examples of all the features including pub/sub, retry, errors etc.

Send & receive

using( var send = new TmMqSender( "TestSendBeforeReceiveStarted" ) )
{
	 var msg = new TmMqMessage();
	 msg.Text = "msg1";
	 send.Send( msg );
}

using( var recv = new TmMqReceiver( "TestSendBeforeReceiveStarted" ) )
{
	 ITmMqMessage recieved = recv.Receive().FirstOrDefault();
}

Pub/sub

using( var rcvr1 = new TmMqPubSubReceiver( "TestPubSub" ) )
using( var rcvr2 = new TmMqPubSubReceiver( "TestPubSub" ) )
using( var rcvr3 = new TmMqPubSubReceiver( "TestPubSub" ) )
using( var rcvr4 = new TmMqPubSubReceiver( "TestPubSub" ) )
{
	 var r1 = new List<ITmMqMessage>();
	 var r2 = new List<ITmMqMessage>();
	 var r3 = new List<ITmMqMessage>();
	 var r4 = new List<ITmMqMessage>();

	 rcvr1.StartReceiving( 1, r1.Add );
	 rcvr2.StartReceiving( 1, r2.Add );
	 rcvr3.StartReceiving( 1, r3.Add );
	 rcvr4.StartReceiving( 1, r4.Add );

	 using( var sender = new TmMqPubSubSender( "TestPubSub" ) )
	 {
			var msg = new TmMqMessage();
			msg.Text = "ps-" + i;
			sender.Send( msg );
	 }

trivialmongomessagequeue's People

Contributors

rabidarts avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.