コード例 #1
0
ファイル: Program.cs プロジェクト: ArneD/parcel-registry
        private static IEnumerable <Task> StartRunners(IConfiguration configuration, IServiceProvider container, CancellationToken ct)
        {
            var addressRunner = new FeedProjectionRunner <AddressEvent, SyndicationContent <Address.Address>, SyndicationContext>(
                "address",
                configuration.GetValue <Uri>("SyndicationFeeds:Address"),
                configuration.GetValue <string>("SyndicationFeeds:AddressAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:AddressAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:AddressPollingInMilliseconds"),
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressPersistentLocalIdProjection());

            yield return(addressRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));
        }
コード例 #2
0
        private static IEnumerable <Task> StartRunners(IConfiguration configuration, IServiceProvider container, CancellationToken ct)
        {
            var municipalityRunner = new FeedProjectionRunner <MunicipalityEvent, SyndicationContent <Gemeente>, SyndicationContext>(
                "municipality",
                configuration.GetValue <Uri>("SyndicationFeeds:Municipality"),
                configuration.GetValue <string>("SyndicationFeeds:MunicipalityAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:MunicipalityAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:MunicipalityPollingInMilliseconds"),
                true,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new MunicipalityLatestProjections());

            yield return(municipalityRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: rubcap/address-registry
        private static IEnumerable <IFeedProjectionRunner <SyndicationContext> > BuildProjectionRunners(IConfiguration configuration, IServiceProvider container)
        {
            ILogger <Program> CreateLogger() => container
            .GetService <ILoggerFactory>()
            .CreateLogger <Program>();

            var municipalityRunner = new FeedProjectionRunner <MunicipalityEvent, SyndicationItem <Municipality.Municipality>, SyndicationContext>(
                "municipality",
                configuration.GetValue <Uri>("SyndicationFeeds:Municipality"),
                configuration.GetValue <string>("SyndicationFeeds:MunicipalityAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:MunicipalityAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:MunicipalityPollingInMilliseconds"),
                false,
                true,
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new MunicipalitySyndiciationItemProjections(),
                new MunicipalityLatestProjections(),
                new MunicipalityBosaProjections());

            var postalInfoRunner = new FeedProjectionRunner <PostalInfoEvent, SyndicationItem <PostalInfo.PostalInfo>, SyndicationContext>(
                "postalInfo",
                configuration.GetValue <Uri>("SyndicationFeeds:PostalInfo"),
                configuration.GetValue <string>("SyndicationFeeds:PostalInfoAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:PostalInfoAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:PostalInfoPollingInMilliseconds"),
                false,
                true,
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new PostalInfoLatestProjections());

            var streetNameRunner = new FeedProjectionRunner <StreetNameEvent, SyndicationItem <StreetName.StreetName>, SyndicationContext>(
                "streetName",
                configuration.GetValue <Uri>("SyndicationFeeds:StreetName"),
                configuration.GetValue <string>("SyndicationFeeds:StreetNameAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:StreetNameAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:StreetNamePollingInMilliseconds"),
                false,
                true,
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new StreetNameSyndicationItemProjections(),
                new StreetNameLatestProjections(),
                new StreetNameBosaProjections());

            var parcelRunner = new FeedProjectionRunner <ParcelEvent, SyndicationItem <Parcel.Parcel>, SyndicationContext>(
                "parcel",
                configuration.GetValue <Uri>("SyndicationFeeds:Parcel"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:ParcelPollingInMilliseconds"),
                false,
                true,
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new ParcelAddressMatchProjections());

            var buildingUnitRunner = new FeedProjectionRunner <BuildingEvent, SyndicationItem <Building>, SyndicationContext>(
                "buildingUnit",
                configuration.GetValue <Uri>("SyndicationFeeds:Building"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:BuildingPollingInMilliseconds"),
                true,
                true,
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new BuildingUnitAddressMatchProjections());

            var buildingUnitAddressRunner = new LinkedFeedProjectionRunner <BuildingEvent, SyndicationItem <Building>, SyndicationContext>(
                "buildingUnitAddressLink",
                configuration.GetValue <Uri>("SyndicationFeeds:Building"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthPassword"),
                false,
                true,
                configuration.GetValue <int>("LinkedFeedRetryPolicy:NumberOfRetryAttempts"),
                configuration.GetValue <int>("LinkedFeedRetryPolicy:JittererMinSeconds"),
                configuration.GetValue <int>("LinkedFeedRetryPolicy:JittererMaxSeconds"),
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressBuildingUnitLinkProjections(DbaseCodePage.Western_European_ANSI.ToEncoding()));

            var parcelAddressRunner = new LinkedFeedProjectionRunner <ParcelEvent, SyndicationItem <Parcel.Parcel>, SyndicationContext>(
                "parcelAddressLink",
                configuration.GetValue <Uri>("SyndicationFeeds:Parcel"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthPassword"),
                false,
                true,
                configuration.GetValue <int>("LinkedFeedRetryPolicy:NumberOfRetryAttempts"),
                configuration.GetValue <int>("LinkedFeedRetryPolicy:JittererMinSeconds"),
                configuration.GetValue <int>("LinkedFeedRetryPolicy:JittererMaxSeconds"),
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressParcelLinkProjections(DbaseCodePage.Western_European_ANSI.ToEncoding()));

            var addressRunner = new LinkedFeedProjectionRunner <AddressEvent, SyndicationItem <Address>, SyndicationContext>(
                "address",
                configuration.GetValue <Uri>("SyndicationFeeds:Address"),
                configuration.GetValue <string>("SyndicationFeeds:AddressAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:AddressAuthPassword"),
                false,
                true,
                configuration.GetValue <int>("LinkedFeedRetryPolicy:NumberOfRetryAttempts"),
                configuration.GetValue <int>("LinkedFeedRetryPolicy:JittererMinSeconds"),
                configuration.GetValue <int>("LinkedFeedRetryPolicy:JittererMaxSeconds"),
                CreateLogger(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressLinkSyndicationProjections(DbaseCodePage.Western_European_ANSI.ToEncoding()));

            var linkedFeedManager = new LinkedFeedProjectionManager <SyndicationContext>(
                new List <ILinkedFeedProjectionRunner <SyndicationContext> >
            {
                addressRunner,
                buildingUnitAddressRunner,
                parcelAddressRunner
            });

            return(new IFeedProjectionRunner <SyndicationContext>[]
            {
                municipalityRunner,
                postalInfoRunner,
                streetNameRunner,
                parcelRunner,
                buildingUnitRunner,
                linkedFeedManager
            });
        }
コード例 #4
0
        private static IEnumerable <Task> StartRunners(IConfiguration configuration, IServiceProvider container, CancellationToken ct)
        {
            var municipalityRunner = new FeedProjectionRunner <MunicipalityEvent, SyndicationItem <Municipality.Municipality>, SyndicationContext>(
                "municipality",
                configuration.GetValue <Uri>("SyndicationFeeds:Municipality"),
                configuration.GetValue <string>("SyndicationFeeds:MunicipalityAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:MunicipalityAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:MunicipalityPollingInMilliseconds"),
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new MunicipalitySyndiciationItemProjections(),
                new MunicipalityLatestProjections(),
                new MunicipalityBosaProjections());

            var postalInfoRunner = new FeedProjectionRunner <PostalInfoEvent, SyndicationItem <PostalInfo.PostalInfo>, SyndicationContext>(
                "postalInfo",
                configuration.GetValue <Uri>("SyndicationFeeds:PostalInfo"),
                configuration.GetValue <string>("SyndicationFeeds:PostalInfoAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:PostalInfoAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:PostalInfoPollingInMilliseconds"),
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new PostalInfoLatestProjections());

            var streetNameRunner = new FeedProjectionRunner <StreetNameEvent, SyndicationItem <StreetName.StreetName>, SyndicationContext>(
                "streetName",
                configuration.GetValue <Uri>("SyndicationFeeds:StreetName"),
                configuration.GetValue <string>("SyndicationFeeds:StreetNameAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:StreetNameAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:StreetNamePollingInMilliseconds"),
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new StreetNameSyndicationItemProjections(),
                new StreetNameLatestProjections(),
                new StreetNameBosaProjections());

            var parcelRunner = new FeedProjectionRunner <ParcelEvent, SyndicationItem <Parcel.Parcel>, SyndicationContext>(
                "parcel",
                configuration.GetValue <Uri>("SyndicationFeeds:Parcel"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:ParcelPollingInMilliseconds"),
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new ParcelAddressMatchProjections());

            var buildingUnitRunner = new FeedProjectionRunner <BuildingEvent, SyndicationItem <Building>, SyndicationContext>(
                "buildingUnit",
                configuration.GetValue <Uri>("SyndicationFeeds:Building"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthPassword"),
                configuration.GetValue <int>("SyndicationFeeds:BuildingPollingInMilliseconds"),
                true,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new BuildingUnitAddressMatchProjections());

            var buildingUnitAddressRunner = new LinkedFeedProjectionRunner <BuildingEvent, SyndicationItem <Building>, SyndicationContext>(
                "buildingUnitAddressLink",
                configuration.GetValue <Uri>("SyndicationFeeds:Building"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:BuildingAuthPassword"),
                0,
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressBuildingUnitLinkProjections(DbaseCodePage.Western_European_ANSI.ToEncoding()));

            var parcelAddressRunner = new LinkedFeedProjectionRunner <ParcelEvent, SyndicationItem <Parcel.Parcel>, SyndicationContext>(
                "parcelAddressLink",
                configuration.GetValue <Uri>("SyndicationFeeds:Parcel"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:ParcelAuthPassword"),
                0,
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressParcelLinkProjections(DbaseCodePage.Western_European_ANSI.ToEncoding()));

            var addressRunner = new LinkedFeedProjectionRunner <AddressEvent, SyndicationItem <Address>, SyndicationContext>(
                "address",
                configuration.GetValue <Uri>("SyndicationFeeds:Address"),
                configuration.GetValue <string>("SyndicationFeeds:AddressAuthUserName"),
                configuration.GetValue <string>("SyndicationFeeds:AddressAuthPassword"),
                0,
                false,
                true,
                container.GetService <ILogger <Program> >(),
                container.GetService <IRegistryAtomFeedReader>(),
                new AddressLinkSyndicationProjections(DbaseCodePage.Western_European_ANSI.ToEncoding()));

            yield return(municipalityRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));

            yield return(postalInfoRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));

            yield return(streetNameRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));

            yield return(parcelRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));

            yield return(buildingUnitRunner.CatchUpAsync(
                             container.GetService <Func <Owned <SyndicationContext> > >(),
                             ct));

            var linkedFeedManager = new LinkedFeedProjectionManager <SyndicationContext>(
                new List <ILinkedFeedProjectionRunner <SyndicationContext> >
            {
                addressRunner,
                buildingUnitAddressRunner,
                parcelAddressRunner
            });

            yield return(linkedFeedManager.CatchUpAsync(container.GetService <Func <Owned <SyndicationContext> > >(), ct));
        }