Ejemplo n.º 1
0
 public static TObserver Create<TObserver>(TObserver observer)
     where TObserver : IInterfacedObserver
 {
     var proxy = InterfacedObserver.Create(typeof(TObserver));
     proxy.Channel = new ObjectNotificationChannel(observer);
     return (TObserver)(object)proxy;
 }
Ejemplo n.º 2
0
        public TObserver Create <TObserver>(TObserver observer, bool startPending = false, bool keepOrder = false)
            where TObserver : IInterfacedObserver
        {
            var proxy = InterfacedObserver.Create(typeof(TObserver));

            proxy.ObserverId = IssueObserverId();
            proxy.Channel    = new ObserverEventDispatcher(observer, startPending, keepOrder);
            AddObserver(proxy.ObserverId, proxy);
            return((TObserver)(object)proxy);
        }
        protected TObserver CreateObserver <TObserver>(object context = null)
            where TObserver : IInterfacedObserver
        {
            var observerId = 0;

            if (context != null)
            {
                var map = EnsureObserverMap();
                observerId = map.IssueId();
                map.AddContext(observerId, context);
            }

            var proxy = InterfacedObserver.Create(typeof(TObserver));

            proxy.ObserverId = observerId;
            proxy.Channel    = new AkkaReceiverNotificationChannel(Self);
            return((TObserver)(object)proxy);
        }
        public TObserver CreateObserver <TObserver>(TObserver observer, IList <NotificationMessage> messages = null)
            where TObserver : IInterfacedObserver
        {
            var observerId = IssueObserverId();

            var local = InterfacedObserver.Create(typeof(TObserver));

            local.ObserverId = observerId;
            local.Channel    = new TestNotificationChannel {
                Observer = observer, Messages = messages
            };
            AddObserver(observerId, local);

            // duplicate an observer for passing to the actor because
            // proxy observer will be updated via IPayloadObserverUpdatable.
            var proxy = InterfacedObserver.Create(typeof(TObserver));

            proxy.ObserverId = observerId;
            return((TObserver)(object)proxy);
        }