Esempio n. 1
0
        public static IObservable <Message> Create(RingBuffer ringbuffer, ConsumerOptions options, StartFrom?startFrom = null, long?value = null)
        {
            if (startFrom == null)
            {
                startFrom = StartFrom.Head;
            }

            var consumer = new Consumer(ringbuffer, options);

            consumer.StartFrom      = startFrom;
            consumer.StartFromValue = value;

            return(Observable.Create((IObserver <Message> observer) =>
            {
                consumer.AddObserver(observer);
                return Disposable.Create(() =>
                {
                    consumer.RemoveObserver(observer);
                });
            }));
        }
Esempio n. 2
0
 internal Producer(RingBuffer queue)
 {
     Queue   = queue;
     _script = LuaScript.Prepare(ScriptPreprocessor(File.ReadAllText("Scripts/publish.lua"))).Load(Queue.Server);
 }