public static NotificationMessage Notification <T>(Action <T> action)
            where T : IInterfacedObserver
        {
            var channel  = new SinkNotificationChannel();
            var observer = InterfacedObserver.Create(typeof(T));

            observer.Channel = channel;
            action((T)(object)observer);
            return(channel.Message);
        }
示例#2
0
        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);
        }