public BootstrapperBase( JobsOptions options, IStorage storage, IProcessingServer server, IApplicationLifetime appLifetime, IServiceProvider provider) { Options = options; Storage = storage; Server = server; _appLifetime = appLifetime; Provider = provider; _cts = new CancellationTokenSource(); _ctsRegistration = appLifetime.ApplicationStopping.Register(() => { _cts.Cancel(); try { _bootstrappingTask?.Wait(); } catch (OperationCanceledException) { } }); }
/// <summary> /// creates or updates a pipeline based on the registrationcontext /// </summary> /// <param name="server"></param> /// <param name="pipelineId"></param> /// <param name="registration"></param> public static void SetupPipeline(this IProcessingServer server, string pipelineId, Action <PipelineRegistration> registration) { //TODO: add the possibility to delay the setup var context = new PipelineRegistration(pipelineId, server); registration(context); }
/// <summary> /// Build the pipeline based on the configuration /// </summary> /// <param name="server"></param> /// <param name="config"></param> public void BuildPipeline(IProcessingServer server, PipelineConfiguration config) { _logger.Write($"Setup Pipeline:{config}", Category.Log, LogLevel.Debug, "PipelineBuilder"); server.SetupPipeline(config.Id, s => { var rootCtx = GlobalConfiguration.Configuration.Resolve <IActivationContext>(); s.Register(() => { var pipeline = new EventPipeline(); foreach (var node in config.OutputHandlers) { var ctx = rootCtx.ChildContext(); var outputHandler = BuildHandler <IOutputHandler>(ctx, node); var converter = node.BuildDataFilter(); if (converter.Filters.Any(f => f.FilterType == Filters.FilterType.Property)) { outputHandler = new DataFilterDecorator(converter, outputHandler); } pipeline.AddHandler(outputHandler); } return(pipeline); }, config.Options); var inputHandler = BuildHandler <IInputHandler>(rootCtx.ChildContext(), config.InputHandler); s.Register(inputHandler); }); }
/// <summary> /// creates or updates a pipeline based on the given configuration /// </summary> /// <param name="server"></param> /// <param name="pipelineId"></param> /// <param name="config"></param> /// <returns></returns> public static IProcessingServer SetupPipeline(this IProcessingServer server, string pipelineId, PipelineConfiguration config) { var builder = new PipelineBuilder(); builder.BuildPipeline(server, config); return(server); }
public BootstrapperBase( JobsOptions options, IStorage storage, IProcessingServer server) { Options = options; Storage = storage; Server = server; }
public SqlServerBootstrapper( JobsOptions options, IStorage storage, IProcessingServer server, IApplicationLifetime appLifetime) : base(options, storage, server) { _appLifetime = appLifetime; }
public JobsManager( JobsOptions options, IStorage storage, IProcessingServer server) { _options = options; _storage = storage; _server = server; }
public SqlServerBootstrapper( JobsOptions options, IStorage storage, IProcessingServer server, IApplicationLifetime appLifetime, IServiceProvider provider) : base(options, storage, server, appLifetime, provider) { }
/// <summary> /// 初始化一个<see cref="TestController"/>类型的实例 /// </summary> public TestController(ITestService testService , IProcessingServer processingServer , IMessageEventBus messageEventBus , IAdminUnitOfWork unitOfWork) { TestService = testService; ProcessingServer = processingServer; MessageEventBus = messageEventBus; UnitOfWork = unitOfWork; }
public JobsManager( JobsOptions options, IStorage storage, IStateChanger stateChanger, IProcessingServer server, IStorageConnection connection) { _options = options; _storage = storage; _stateChanger = stateChanger; _server = server; _connection = connection; }
public void Initialize(IProcessingServer server) { _server = server; _broadcaster = new Broadcaster(ProcessorMode.Background); var interval = _arguments.GetValue <int>("Interval"); if (interval == 0) { interval = 10; } // delay start to end initializing _broadcaster.Schedule(() => _broadcaster.Recurring(Process, TimeSpan.FromSeconds(interval)), TimeSpan.FromSeconds(10)); }
/// <summary> /// 初始化一个<see cref="TestController"/>类型的实例 /// </summary> public TestController(ITestService testService , IProcessingServer processingServer , IMessageEventBus messageEventBus , IAdminUnitOfWork unitOfWork , IExceptionNotifier exceptionNotifier , ILogger <TestController> logger , ILog <TestController> otherLog) { TestService = testService; ProcessingServer = processingServer; MessageEventBus = messageEventBus; UnitOfWork = unitOfWork; ExceptionNotifier = exceptionNotifier; Logger = logger; OtherLog = otherLog; }
/// <summary> /// Register an EventPipeline to the pipeline /// </summary> /// <param name="pipelineId"></param> /// <param name="factory"></param> public static void Register(this IProcessingServer server, string pipelineId, Func <EventPipeline> factory) => server.Register(pipelineId, factory, new PipelineOptions());
public void Initialize(IProcessingServer server) { Server = server; }
/// <summary> /// Creates a new instance of the PipelineRegistration /// </summary> /// <param name="pipelineId"></param> /// <param name="server"></param> internal PipelineRegistration(string pipelineId, IProcessingServer server) { _pipelineId = pipelineId; _server = server; }
/// <summary> /// Creates a new instance of the PipelineMonitor /// </summary> /// <param name="server"></param> public PipelineMonitor(IProcessingServer server) { _server = server; }
/// <summary> /// Creates a new instance of the EventDispatcher /// </summary> /// <param name="server">The <see cref="IProcessingServer"/> that the events are dispatched to</param> public EventDispatcher(IProcessingServer server) { _server = server; }
public ValuesController(ICapPublisher publisher, IServiceProvider serviceProvider, IProcessingServer processingServer) { _publisher = publisher; _serviceProvider = serviceProvider; _processingServer = processingServer; }
private IEnumerable <IOutputHandler> GetOutputHandlers(IProcessingServer server, string pipelineId) { return(server.EventBusFactory.GetEventBus(pipelineId).PipelineFactory.Setup().Handlers); }
/// <summary> /// Add the dashbaord API /// </summary> /// <param name="services"></param> /// <param name="server"></param> /// <returns></returns> public static IServiceCollection AddGauchoServer(this IServiceCollection services, IProcessingServer server) { if (services == null) { throw new ArgumentNullException(nameof(services)); } // ===== Configurable services ===== //services.TryAddSingletonChecked(_ => JobStorage.Current); //services.TryAddSingletonChecked(_ => JobActivator.Current); services.TryAddSingletonChecked <IPipelineMonitor>(_ => new PipelineMonitor(server)); services.TryAddSingletonChecked(_ => DashboardRoutes.Routes); return(services); }
public static IServiceCollection AddGauchoDashboard(this IServiceCollection services, IProcessingServer server) { return(AddGauchoServer(services, server)); }