Back to Catalog
This article is in fact my heart of the core components of the seventh back, indeed in time some lag, but the content is not lag! MSMQ is just an introduction, I really do not want to say it, it is Microsoft's own integration of a set of message queue, hosted in the window service, stability Ten is not flattering, and Redis queue we choose the driver client is Servicestack.redis, It is chosen because it is stable, update fast, and for other drivers may not be updated for a few years, and Servicestack.redis has been to the forefront of REDIS clients!
Redis Queue Real-time and non-real time: This is said real-time and non-real-time mainly for the consumer side, the message producer in the production of messages, the Redis queue to store these messages, and when the consumption is our concern, not real-time is said to have a rotation service on the backend from the queue to get messages, This has a certain degree of delay; in real time, a long TCP connection is established on the consumer side, when the queue has data to consume it immediately, when there is no data, the thread is suspended waiting state!
Uncle Real-time Message Queuing consumer implementations (Redis queue)
while(true) { varRedis = Redis.Client.RedisManager.GetClient ();//Redis Connection Pooling if(Redis. GetListCount ("queue1") ==0)//message is empty pending{Console.foregroundcolor=Consolecolor.green; Console.WriteLine ("queue is empty, suspended for 1 seconds"); Thread.Sleep ( +); } Else{Console.foregroundcolor=Consolecolor.yellow; Console.WriteLine ("take out the queue:"+Redis. Popitemfromlist ("queue1")); } }
Uncle the implementation of non-real-time message queue
Non-real-time queue is mainly in the consumer side of the use of a certain scheduling mechanism, timed to the Redis queue to get data, logic is not complex, the uncle used the scheduling component or quartz.net, the reason is that it is powerful, flexible configuration, decoupling ability is stronger!
The ability to work with cron expressions is more powerful
Back to Catalog
Core components of my heart ~msmq and Redis queues