Skip to content

Instantly share code, notes, and snippets.

@chakrit
Created May 31, 2013 05:41
Show Gist options
  • Save chakrit/5683109 to your computer and use it in GitHub Desktop.
Save chakrit/5683109 to your computer and use it in GitHub Desktop.
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