示例#1
0
        public IDisposable Connect(IRxnPublisher <IRxn> publisher)
        {
            var reaction = RxnCreator.AttachPublisher(publisher, typeof(TEvent), this);
            var health   = AttachHealthMonitorIf(publisher);

            _molecules.Add(publisher);
            OnInformation("Connected to EventPublisher '{0}'", publisher.GetType());

            return(new CompositeDisposable(reaction, new DisposableAction(() =>
            {
                if (health != null)
                {
                    health.Dispose();
                }

                OnInformation("Disconnected EventPublisher '{0}'", publisher.GetType().Name);
                _molecules.Remove(publisher);
            }))
                   .DisposedBy(_resources));;
        }
示例#2
0
        public IDisposable Connect(IReactTo <IRxn> reaction, IScheduler inputScheduler = null)
        {
            var resource = RxnCreator.AttachReaction(reaction, typeof(IRxn), this, inputScheduler);
            var health   = AttachHealthMonitorIf(reaction);

            _molecules.Add(reaction);
            OnInformation("Connected to reaction '{0}'", reaction.GetType());

            return(new CompositeDisposable(resource, new DisposableAction(() =>
            {
                if (health != null)
                {
                    health.Dispose();
                }

                OnInformation("Disconnected reaction '{0}'", reaction.GetType());
                _molecules.Remove(reaction);
            }))
                   .DisposedBy(_resources));
        }
示例#3
0
        public IDisposable Connect(object irxnProcessor /*recovery mode */, IScheduler inputScheduler = null)
        {
            var resource = RxnCreator.AttachProcessor(irxnProcessor, null, this, inputScheduler);
            var health   = AttachHealthMonitorIf(irxnProcessor);

            _molecules.Add(irxnProcessor);
            OnInformation("Connected to rxnProcessor '{0}'", irxnProcessor.GetType().Name);

            return(new CompositeDisposable(resource, new DisposableAction(() =>
            {
                if (health != null)
                {
                    health.Dispose();
                }

                OnInformation("Disconnected rxnProcessor '{0}'", irxnProcessor.GetType().Name);
                _molecules.Remove(irxnProcessor);
            }))
                   .DisposedBy(_resources));
        }