Created
May 31, 2013 05:41
-
-
Save chakrit/5683109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Sider; | |
namespace DummyConsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var pump = new Task(Pump); | |
var drain = new Task(Drain); | |
pump.Start(); | |
drain.Start(); | |
Task.WaitAll(pump, drain); | |
} | |
private static void Pump() | |
{ | |
var client = new RedisClient(); | |
while (true) { | |
client.Publish("HELLO", DateTime.Now.ToString()); | |
} | |
} | |
private static void Drain() | |
{ | |
var client = new RedisClient(); | |
var channel = client.Subscribe("HELLO"); | |
channel.Subscribe((m) => Console.WriteLine(m.Body)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment