public Bootstrapper(CommitContext commitContext, CommitSynchroniserContext commitSynchroniserContext, ServerContext serverContext, EventHandlerContext eventHandlerContext) { this.commitContext = commitContext; this.commitSynchroniserContext = commitSynchroniserContext; this.serverContext = serverContext; this.eventHandlerContext = eventHandlerContext; }
public ActionInvoker(EventHandlerContext context, CancellationToken cancellationToken, ServicesContainer services) { Contract.Requires(services != null); this.context = context; this.cancellationToken = cancellationToken; this.services = services; }
public EventHandlerResult OnEvent(EventHandlerContext context) { dynamic state = new ExpandoObject(); state.id = context.State.id; state.owner = context.Event.owner; state.balance = 0.0; return(new EventHandlerResult(state, AccountStates.Open)); }
public EventHandlerResult OnEvent(EventHandlerContext context) { dynamic state = new ExpandoObject(); state.id = context.State.id; state.owner = context.Event.owner; state.balance = context.State.balance - context.Event.amount; return(new EventHandlerResult(state, context.StateName)); }
private void SubscribeToAllEventsOnObject(string name, object target) { foreach (EventInfo eventInfo in target.GetType().GetEvents()) { EventHandlerContext context = new EventHandlerContext(this, name + eventInfo.Name); MethodInfo methodInfo = context.GetType().GetMethod("HandleEvent"); Delegate handler = Delegate.CreateDelegate(eventInfo.EventHandlerType, context, methodInfo); eventInfo.AddEventHandler(target, handler); } }
public EventHandlerFilterResult(EventHandlerContext context, ServicesContainer services, IEventHandlerFilter[] filters) { Contract.Requires(context != null); Contract.Requires(services != null); Contract.Requires(filters != null); this.context = context; this.services = services; this.filters = filters; }
/// <summary> /// Initializes a new instance of the <see cref="EventHandlerOccurredContext"/> class. /// </summary> /// <param name="handlerContext">Then handler context.</param> /// <param name="exceptionInfo">The <see cref="ExceptionDispatchInfo"/>. Optionnal.</param> public EventHandlerOccurredContext(EventHandlerContext handlerContext, ExceptionDispatchInfo exceptionInfo) { if (handlerContext == null) { throw Error.ArgumentNull("handlerContext"); } this.handlerContext = handlerContext; this.ExceptionInfo = exceptionInfo; }
public string Post([FromBody] Command command) { var json = command.ToString(); EventHandler eventHandler = new EventHandler(); IContext context = new EpidemyContext(json); EventHandlerContext eventHandlerContext = new EventHandlerContext(); eventHandlerContext.contextHandler = context; eventHandlerContext.command = EventHandlerFunctions.EpidemyAlertModule; eventHandlerContext.subModuleCommand = SubModuleFunctions.EpidemyCheckForAreas; eventHandler.InvokeCommand(eventHandlerContext); return(context.json); }
Task IEventHandlerFilter.ExecuteHandlerFilterAsync(EventHandlerContext handlerContext, CancellationToken cancellationToken, Func <Task> continuation) { return(this.TraceWriter.TraceBeginEndAsync( handlerContext.Request, TraceCategories.FiltersCategory, TraceLevel.Info, this.InnerActionFilter.GetType().Name, ExecuteActionFilterAsyncMethodName, beginTrace: null, execute: () => this.InnerActionFilter.ExecuteHandlerFilterAsync(handlerContext, cancellationToken, continuation), endTrace: null, errorTrace: null)); }
public String Post([FromBody] String disease) { EventHandler eventHandler = new EventHandler(); EpidemyContext context = new EpidemyContext(); context.specificSearch = disease; EventHandlerContext eventHandlerContext = new EventHandlerContext(); eventHandlerContext.contextHandler = context; eventHandlerContext.command = EventHandlerFunctions.EpidemyAlertModule; eventHandlerContext.subModuleCommand = SubModuleFunctions.EpidemyCheckForAlert; eventHandler.InvokeCommand(eventHandlerContext); return(context.json); }
public string Post([FromForm] Symptomes symptomeList) { var json = symptomeList.ToString(); IContext context = new IContext(json); EventHandlerContext eventHandlerContext = new EventHandlerContext(); eventHandlerContext.contextHandler = context; eventHandlerContext.command = EventHandlerFunctions.SymptomLearningModule; eventHandlerContext.subModuleCommand = SubModuleFunctions.MachineLearningStoreResults; EventHandler eventHandler = new EventHandler(); eventHandler.InvokeCommand(eventHandlerContext); return("succes"); }
public String Post([FromBody] JObject data) { int id = data["id"].ToObject <int>(); byte[] idBytes = BitConverter.GetBytes(id); IContext context = new SymptomContext(id, 0); EventHandlerContext eventHandlerContext = new EventHandlerContext(idBytes, idBytes.Length); eventHandlerContext.command = EventHandlerFunctions.SymptomBasedDetectionModule; eventHandlerContext.subModuleCommand = SubModuleFunctions.GetQuestion; eventHandlerContext.contextHandler = context; EventHandler eventHandler = EventHandler.GetInstance(); eventHandler.InvokeCommand(eventHandlerContext); return((context as SymptomContext).response); }
public static Func <Task> InvokeHandlerWithHandlerFiltersAsync(EventHandlerContext context, CancellationToken cancellationToken, IEventHandlerFilter[] filters, Func <Task> innerAction) { Contract.Requires(context != null); Contract.Requires(filters != null); Contract.Requires(innerAction != null); Func <Task> result = innerAction; for (int i = filters.Length - 1; i >= 0; i--) { IEventHandlerFilter commandFilter = filters[i]; Func <Func <Task>, IEventHandlerFilter, Func <Task> > chainContinuation = (continuation, innerFilter) => () => innerFilter.ExecuteHandlerFilterAsync(context, cancellationToken, continuation); result = chainContinuation(result, commandFilter); } return(result); }
protected override Task Handle(EventHandlerContext context, Event @event) { Assert.NotNull(context.ServiceBus); Assert.NotNull(context.User); return(TaskCache.CompletedTask); }
private static Func <Task> InvokeActionWithActionFilters(EventHandlerContext context, CancellationToken cancellationToken, IEventHandlerFilter[] filters, Func <ActionInvoker, Task> innerAction, ActionInvoker state) { return(InvokeHandlerWithHandlerFiltersAsync(context, cancellationToken, filters, () => innerAction(state))); }
public Task Handle(EventHandlerContext context, IEvent @event) { throw new NotImplementedException(); }
public static Task ProcessAsync(this EventHandlerContext context, ICommand command) { var processor = context.Configuration.Services.GetProcessor(); return(processor.ProcessAsync(command)); }
public Task HandleEventAsync(EventHandlerContext <ISimpleEvent> context, CancellationToken cancellationToken = default) { context.Event.Counter++; return(Task.CompletedTask); }
Bootstrapper(EventSessionContext eventSessionContext, SynchronisableCommitContext synchronisableCommitContext, EventHandlerContext eventHandlerContext) { this.eventSessionContext = eventSessionContext; this.synchronisableCommitContext = synchronisableCommitContext; this.eventHandlerContext = eventHandlerContext; }