public void Register() { _actor.Receive(_handler); _actor.Start.Subscribe(context => context.System.EventStream.Subscribe <TEvent>(context.Self)) .DisposeWith(_actor); _actor.Stop.Subscribe(context => context.System.EventStream.Unsubscribe <TEvent>(context.Self)) .DisposeWith(_actor); }
public static void RespondOnEventSource <TData>(this IObservableActor actor, IEventSource <TData> eventSource, Action <TData> action) { eventSource.RespondOn(ObservableActor.ExposedContext.Self); actor.Receive <TData>(obs => obs.SubscribeWithStatus(action)); }
public static void Receive <TEvent>(this IObservableActor actor, Action <TEvent> handler) => actor.Receive <TEvent>(obs => obs.SubscribeWithStatus(handler));