void IObserverCollection.Detach(IObserve observer, Type @event) { var observers = Observers(@event); if (observers != null) observers.Remove(observer); }
public async Task Unsubscribe(string source, IObserve proxy, params Type[] notifications) { Type notifier = null; foreach (var notification in notifications) { Type grainType; if (!notifiers.TryGetValue(notification, out grainType)) { throw new ApplicationException("Can't find source grain which handles notification type " + notification.FullName); } if (notifier != null && notifier != grainType) { throw new ApplicationException("Can't unsubscribe from multiple grain types for the same source id"); } notifier = grainType; } var reference = factory.GetReference(notifier, source); var observable = (IMessageBasedGrain)reference; await observable.Detach(proxy, notifications); }
public void RemoveObserver(IObserve ob) { if (observers.Contains(ob)) { observers.Remove(ob); } }
void IObserverCollection.Detach(IObserve observer, Type notification) { var observers = Observers(notification); if (observers != null) { observers.Remove(observer); } }
void IObserverCollection.Attach(IObserve observer, Type notification) { if (RecordedSubscriptions.Any(x => x.Observer == observer && x.Notification == notification)) { return; } RecordedSubscriptions.Add(new RecordedSubscription(observer, notification)); }
public void SetUp() { bus = MessageBus.Instance; client = new Observe(); proxy = SubscriptionManager.Instance.CreateProxy(client).Result; collection = new ObserverCollection(); }
/// <summary> /// Attaches given selective observer for the given types of notifications. /// </summary> /// <param name="observer">The observer proxy.</param> /// <param name="notifications">The types of notifications</param> /// <remarks>The operation is idempotent</remarks> protected virtual Task OnAttach(IObserve observer, params Type[] notifications) { foreach (var notification in notifications) { observers.Attach(observer, notification); } return(TaskDone.Done); }
static void TryDeliver(IObserve observer, Notification[] notifications, string source, ICollection <IObserve> failed) { try { observer.On(source, notifications); } catch (Exception) { failed.Add(observer); } }
void IObserverCollection.Attach(IObserve observer, Type notification) { var observers = Observers(notification); if (observers == null) { observers = new HashSet <IObserve>(); subscriptions.Add(notification, observers); } observers.Add(observer); }
void IObserverCollection.Attach(IObserve observer, Type @event) { var observers = Observers(@event); if (observers == null) { observers = new HashSet<IObserve>(); subscriptions.Add(@event, observers); } observers.Add(observer); }
public void Detach(IObserve observe) { ls.Remove(observe); }
public void registerSubscriber(IObserve observe) { list.Add(observe); }
public void Add(IObserve observer) { _observerlist.Add(observer); }
public void Attach(IObserve observe) { ls.Add(observe); }
public void AddObserve(IObserve observe) { observes.Add(observe); }
public void SetUp() { client = new Observe(); proxy = SubscriptionManager.Instance.CreateProxy(client).Result; collection = new ObserverCollection(); }
//对同一个订阅号,新增和删除订阅者的操作 public void AddObserver(IObserve ob) { observers.Add(ob); }
public Task SubscribeForUpdates(IObserve subscriber) { subscribers.Subscribe(subscriber); return(TaskDone.Done); }
// accept subscriptions public Task SubscribeForUpdates(IObserve subscriber) { // add new subscriber to list of subscribers subscribers.Subscribe(subscriber); return TaskDone.Done; }
public void RemoveObserve(IObserve observe) { observes.Remove(observe); }
public static void DeleteObjectReference(IObserve reference) { GrainReference.DeleteObjectReference(reference); }
public async static System.Threading.Tasks.Task<IObserve> CreateObjectReference(IObserve obj) { if (methodInvoker == null) methodInvoker = new ObserveMethodInvoker(); return ObserveFactory.Cast(await GrainReference.CreateObjectReference(obj, methodInvoker)); }
private Message PerformMapping(IObserve source) { return Mapping.Map<IObserve, Observe>(source); }
void Initialize(IObserve proxy) { this.proxy = proxy; }
// implemented ISubject methods public void RegisterObserver(IObserve o) { observers.Add(o); }
public RecordedSubscription(IObserve observer, Type notification) { Observer = observer; Notification = notification; }
public async static System.Threading.Tasks.Task <IObserve> CreateObjectReference(IObserve obj) { if (methodInvoker == null) { methodInvoker = new ObserveMethodInvoker(); } return(ObserveFactory.Cast(await GrainReference.CreateObjectReference(obj, methodInvoker))); }
private Message PerformMapping(IObserve source) { return(Mapping.Map <IObserve, Observe>(source)); }
void IObserverCollection.Detach(IObserve observer, Type notification) { RecordedSubscriptions.RemoveAll(x => x.Observer == observer && x.Notification == notification); }
Task IMessageBasedGrain.Detach(IObserve observer, params Type[] notifications) { return(OnDetach(observer, notifications)); }
public void Remove(IObserve observer) { this._observerlist.Remove(observer); }
public void removeSubscriber(IObserve observe) { list.Remove(observe); }
// accept subscriptions public Task SubscribeForUpdates(IObserve subscriber) { // add new subscriber to list of subscribers subscribers.Subscribe(subscriber); return(TaskDone.Done); }
public void RemoveObserver(IObserve o) { observers.Remove(o); }
public async Task <IObserve> CreateProxy(IObserve client) { return(await ObserveFactory.CreateObjectReference(client)); }
public void DeleteProxy(IObserve observer) { ObserveFactory.DeleteObjectReference(observer); }