Example #1
0
        /// <summary>
        ///     Starts the DataFeed Service.
        ///     Called by the service host when the service is started.
        /// </summary>
        public async Task Start()
        {
            Log.Information("DataFeed service is starting");
            scheduler = await SchedulerConfigurator.Configure(kernel);

            // Configure Bus
            bus = BusConfigurator.ConfigureBus(MonitoredServices.DataFeedService, (cfg, host) => { cfg.UseSerilog(); });

            // Add the bus instance to the IoC container
            kernel.Bind <IBus>().ToMethod(context => bus).InSingletonScope();
            kernel.Bind <IBusControl>().ToMethod(context => bus).InSingletonScope();
            bus.Start();

            // Start the timer
            Log.Verbose("Starting scheduler");
            await scheduler.Start();

            Log.Information("DataFeed service started");
        }
Example #2
0
        /// <summary>
        ///     Starts the DataFeed Service.
        ///     Called by the service host when the service is started.
        /// </summary>
        public async Task Start()
        {
            Log.Information("DataFeed service is starting");

            // Configure Bus
            BusConfigurator.ConfigureBus(containerBuilder, MonitoredServices.DataFeedService, (cfg, ctx) => { });
            container = containerBuilder.Build();
            bus       = container.Resolve <IBusControl>();
            bus.Start();

            // Start the timer
            scheduler = await SchedulerConfigurator.Configure(container);

            Log.Verbose("Starting scheduler");
            await scheduler.Start();


            Log.Information("DataFeed service started");
        }
Example #3
0
        /// <summary>
        ///     Starts the Asset Service.
        ///     Called by the service host when the service is started.
        /// </summary>
        public async Task Start()
        {
            Log.Information("Asset service is starting");

            EnsurePasswordSeedIsConfigured();
            var helper = new ParameterBusHelper();

            // Configure Bus
            BusConfigurator.ConfigureBus(builder, MonitoredServices.AssetService, (cfg, ctx) =>
            {
                cfg.ReceiveEndpoint(BusConstants.AssetManagerExtractFulltextMessageQueue, ec =>
                {
                    ec.Consumer(ctx.Resolve <ExtractFulltextPackageConsumer>);
                    ec.UseRetry(retryPolicy =>
                                retryPolicy.Exponential(10, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5)));
                    BusConfigurator.SetPrefetchCountForEndpoint(ec);
                });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerTransformAssetMessageQueue, ec =>
                {
                    ec.Consumer(ctx.Resolve <TransformPackageConsumer>);
                    BusConfigurator.SetPrefetchCountForEndpoint(ec);
                });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerPrepareForRecognition, ec =>
                {
                    ec.Consumer(ctx.Resolve <PrepareForRecognitionConsumer>);
                    BusConfigurator.SetPrefetchCountForEndpoint(ec);
                });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerPrepareForTransformation, ec =>
                {
                    ec.Consumer(ctx.Resolve <PrepareForTransformationConsumer>);
                    BusConfigurator.SetPrefetchCountForEndpoint(ec);
                });

                cfg.ReceiveEndpoint(BusConstants.WebApiDownloadAssetRequestQueue, ec => { ec.Consumer(ctx.Resolve <DownloadAssetConsumer>); });
                cfg.ReceiveEndpoint(BusConstants.WebApiGetAssetStatusRequestQueue, ec => { ec.Consumer(ctx.Resolve <GetAssetStatusConsumer>); });
                cfg.ReceiveEndpoint(BusConstants.WebApiPrepareAssetRequestQueue, ec => { ec.Consumer(ctx.Resolve <PrepareAssetConsumer>); });
                cfg.ReceiveEndpoint(BusConstants.AssetManagerAssetReadyEventQueue, ec =>
                {
                    ec.Consumer(ctx.Resolve <AssetReadyConsumer>);
                    // Retry or we have the situation where the job is not marked as terminated in the DB.
                    ec.UseRetry(retryPolicy =>
                                retryPolicy.Exponential(10, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5)));
                });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerSchdeduleForPackageSyncMessageQueue, ec => { ec.Consumer(ctx.Resolve <ScheduleForPackageSyncConsumer>); });
                cfg.ReceiveEndpoint(BusConstants.AssetManagerUpdatePrimaerdatenAuftragStatusMessageQueue, ec => { ec.Consumer(ctx.Resolve <UpdatePrimaerdatenAuftragStatusConsumer>); });

                helper.SubscribeAllSettingsInAssembly(Assembly.GetExecutingAssembly(), cfg);
                helper.SubscribeAllSettingsInAssembly(Assembly.GetAssembly(typeof(Engine.Asset.AssetPreparationEngine)), cfg);
            });

            builder.Register(CreateDoesExistInCacheRequestClient);
            builder.Register(CreateJobInitRequestClient);
            builder.Register(CreateSupportedFileTypesRequestClient);
            builder.Register(CreateDocumentConversionRequestClient);
            builder.Register(CreateDocumentExtractionRequestClient);
            builder.Register(CreateFindArchiveRecordRequestClient);

            container = builder.Build();
            scheduler = await SchedulerConfigurator.Configure(container);

            bus = container.Resolve <IBusControl>();
            bus.Start();

            // Start the timer
            Log.Verbose("Starting scheduler");
            await scheduler.Start();

            Log.Information("Asset service started");
        }
Example #4
0
        /// <summary>
        ///     Starts the Asset Service.
        ///     Called by the service host when the service is started.
        /// </summary>
        public async Task Start()
        {
            Log.Information("Asset service is starting");
            scheduler = await SchedulerConfigurator.Configure(kernel);

            EnsurePasswordSeedIsConfigured();


            // Configure Bus
            var helper = new ParameterBusHelper();

            bus = BusConfigurator.ConfigureBus(MonitoredServices.AssetService, (cfg, host) =>
            {
                cfg.ReceiveEndpoint(BusConstants.AssetManagerExtractFulltextMessageQueue, ec =>
                {
                    ec.Consumer(() => kernel.Get <ExtractFulltextPackageConsumer>());
                    ec.UseRetry(retryPolicy =>
                                retryPolicy.Exponential(10, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5)));
                    BusConfigurator.SetPrefetchCountForEndpoint(ec);
                });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerTransformAssetMessageQueue,
                                    ec =>
                {
                    ec.Consumer(() => kernel.Get <TransformPackageConsumer>());
                    BusConfigurator.SetPrefetchCountForEndpoint(ec);
                });

                cfg.ReceiveEndpoint(BusConstants.WebApiDownloadAssetRequestQueue, ec => { ec.Consumer(() => kernel.Get <DownloadAssetConsumer>()); });

                cfg.ReceiveEndpoint(BusConstants.WebApiGetAssetStatusRequestQueue,
                                    ec => { ec.Consumer(() => kernel.Get <GetAssetStatusConsumer>()); });

                cfg.ReceiveEndpoint(BusConstants.WebApiPrepareAssetRequestQueue, ec => { ec.Consumer(() => kernel.Get <PrepareAssetConsumer>()); });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerAssetReadyEventQueue, ec =>
                {
                    ec.Consumer(() => kernel.Get <AssetReadyConsumer>());
                    // Retry or we have the situation where the job is not marked as terminated in the DB.
                    ec.UseRetry(retryPolicy =>
                                retryPolicy.Exponential(10, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5)));
                });

                cfg.ReceiveEndpoint(BusConstants.MonitoringAbbyyOcrTestQueue, ec => { ec.Consumer(() => kernel.Get <AbbyyOcrTestConsumer>()); });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerSchdeduleForPackageSyncMessageQueue,
                                    ec => { ec.Consumer(() => kernel.Get <ScheduleForPackageSyncConsumer>()); });

                cfg.ReceiveEndpoint(BusConstants.AssetManagerUpdatePrimaerdatenAuftragStatusMessageQueue,
                                    ec => { ec.Consumer(() => kernel.Get <UpdatePrimaerdatenAuftragStatusConsumer>()); });

                helper.SubscribeAllSettingsInAssembly(Assembly.GetExecutingAssembly(), cfg, host);
                cfg.UseSerilog();
            });

            // Add the bus instance to the IoC container
            kernel.Bind <IBus>().ToMethod(context => bus).InSingletonScope();
            kernel.Bind <IBusControl>().ToMethod(context => bus).InSingletonScope();
            kernel.Bind <IRequestClient <DoesExistInCacheRequest, DoesExistInCacheResponse> >().ToMethod(CreateDoesExistInCacheRequestClient);
            kernel.Bind <IRequestClient <JobInitRequest, JobInitResult> >().ToMethod(CreateJobInitRequestClient);
            kernel.Bind <IRequestClient <SupportedFileTypesRequest, SupportedFileTypesResponse> >().ToMethod(CreateSupportedFileTypesRequestClient);
            kernel.Bind <IRequestClient <ConversionStartRequest, ConversionStartResult> >().ToMethod(CreateDocumentConversionRequestClient);
            kernel.Bind <IRequestClient <ExtractionStartRequest, ExtractionStartResult> >().ToMethod(CreateDocumentExtractionRequestClient);
            kernel.Bind <IRequestClient <FindArchiveRecordRequest, FindArchiveRecordResponse> >().ToMethod(CreateFindArchiveRecordRequestClient);

            bus.Start();

            // Start the timer
            Log.Verbose("Starting scheduler");
            await scheduler.Start();

            Log.Information("Asset service started");
        }