Brod persistent message store
상속: IDisposable
예제 #1
0
파일: Broker.cs 프로젝트: paralect/brod
        public void Start()
        {
            using(var store = new Store(_configuration))
            {
                var handlers = new RequestHandlers(_configuration, store);

                var engine = new TaskEngine(
                    new SocketListener(ZMQ.SocketType.REP, _configuration.Port, handlers.MapHandlers),
                    new SocketListener(ZMQ.SocketType.PULL, _configuration.PullPort, handlers.MapHandlers),
                    new Flusher(_configuration, store));

                using (var token = new CancellationTokenSource())
                using (engine)
                {
                    var task1 = engine.Start(token.Token, Timeout.Infinite);

                    if (task1.Wait(Timeout.Infinite))
                        Console.WriteLine("Done without forced cancelation"); // This line shouldn't be reached
                    else
                        Console.WriteLine("\r\nRequesting to cancel...");

                    token.Cancel();
                }
            }
        }
예제 #2
0
파일: Flusher.cs 프로젝트: paralect/brod
 public Flusher(BrokerConfiguration configuration, Store storage)
 {
     _configuration = configuration;
     _storage = storage;
 }
예제 #3
0
 public RequestHandlers(BrokerConfiguration configuration, Store storage)
 {
     _configuration = configuration;
     _storage = storage;
 }