private ReplaySubject <FlowEvent> GetObservableWithElement(FlowEvent flowEvent) { var observable = new ReplaySubject <FlowEvent>(); observable.OnNext(flowEvent); flowEvent.ContextOfEvent.Disposed += OnContextDisposed; return(observable); }
public void AddEvent(FlowEvent flowEvent) { if (flowEvent.ContextOfEvent == null) { throw new ArgumentException("context must be set on each event before raising it"); } flowEvents.AddOrUpdate(flowEvent.ContextOfEvent, (context) => GetObservableWithElement(flowEvent), //if context does not exist create new observable (context, obs) => //If context exists, add event to context and return it { obs.OnNext(flowEvent); return(obs); }); allFlowEventsObservable.OnNext(flowEvent); }
public void RaiseEvent(FlowEvent flowEvent) { eventStore.AddEvent(flowEvent); }
public void RaiseEventInCurrentContext(FlowEvent flowEvent) { flowEvent.ContextOfEvent = CurrentContext; RaiseEvent(flowEvent); }