Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add postal read consumer #323

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/deploy_newprd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ jobs:
strategy:
matrix:
services: [
'streetname-registry-api',
'streetname-registry-projections',
'streetname-registry-backoffice-api',
'streetname-registry-consumer',
'streetname-registry-producer',
'streetname-registry-migrator-streetname',
'streetname-registry-producer-snapshot-oslo',
'streetname-registry-projections-backoffice',
'streetname-registry-snapshot-verifier']
'streetname-registry-api',
'streetname-registry-projections',
'streetname-registry-backoffice-api',
'streetname-registry-consumer',
'streetname-registry-producer',
'streetname-registry-migrator-streetname',
'streetname-registry-producer-snapshot-oslo',
'streetname-registry-projections-backoffice',
'streetname-registry-snapshot-verifier'
]

steps:
- name: CD services
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ jobs:
semver: ${{ needs.set-release-version.outputs.version }}
secrets: inherit

build-consumer-read-postal:
name: Build Consumer Read Postal
uses: Informatievlaanderen/build-pipeline/.github/workflows/build-image.yml@main
needs: [ set-release-version ]
if: ${{ (github.repository_owner == 'Informatievlaanderen') && (needs.set-release-version.outputs.version != 'none') }}
with:
registry: streetname-registry
build-target: Containerize_ConsumerReadPostal
image-file: sr-consumer-read-postal-image.tar
image-name: consumer-read-postal
test-project: StreetNameRegistry.Tests
build-project: StreetNameRegistry.Consumer.Read.Postal
semver: ${{ needs.set-release-version.outputs.version }}
secrets: inherit

pack-api-backoffice:
name: Pack Api BackOffice
uses: Informatievlaanderen/build-pipeline/.github/workflows/pack.yml@main
Expand Down Expand Up @@ -356,7 +371,8 @@ jobs:
, build-producer-snapshot-oslo
, build-migrator-streetname
, build-lambda-backoffice
, build-snapshot-verifier]
, build-snapshot-verifier
, build-consumer-read-postal]
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
Expand Down Expand Up @@ -1098,7 +1114,8 @@ jobs:
, 'streetname-registry-migrator-streetname'
, 'streetname-registry-producer-snapshot-oslo'
, 'streetname-registry-projections-backoffice'
, 'streetname-registry-snapshot-verifier']
, 'streetname-registry-snapshot-verifier'
]

steps:
- name: CD services
Expand Down Expand Up @@ -1217,7 +1234,8 @@ jobs:
, 'streetname-registry-migrator-streetname'
, 'streetname-registry-producer-snapshot-oslo'
, 'streetname-registry-projections-backoffice'
, 'streetname-registry-snapshot-verifier']
, 'streetname-registry-snapshot-verifier'
]

steps:
- name: CD services
Expand Down
7 changes: 7 additions & 0 deletions StreetNameRegistry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StreetNameRegistry.Api.Back
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StreetNameRegistry.Snapshot.Verifier", "src\StreetNameRegistry.Snapshot.Verifier\StreetNameRegistry.Snapshot.Verifier.csproj", "{06F8F677-2696-4996-B4AE-B8E3B747A696}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StreetNameRegistry.Consumer.Read.Postal", "src\StreetNameRegistry.Consumer.Read.Postal\StreetNameRegistry.Consumer.Read.Postal.csproj", "{83C7D129-ACEA-4FC6-A55C-748D8D31135A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -185,6 +187,10 @@ Global
{06F8F677-2696-4996-B4AE-B8E3B747A696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06F8F677-2696-4996-B4AE-B8E3B747A696}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06F8F677-2696-4996-B4AE-B8E3B747A696}.Release|Any CPU.Build.0 = Release|Any CPU
{83C7D129-ACEA-4FC6-A55C-748D8D31135A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83C7D129-ACEA-4FC6-A55C-748D8D31135A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83C7D129-ACEA-4FC6-A55C-748D8D31135A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83C7D129-ACEA-4FC6-A55C-748D8D31135A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -215,6 +221,7 @@ Global
{C1C797C7-4A24-4E9C-B7D0-7E097562342E} = {65EA04DE-5928-430F-92CA-24C11B6E5A00}
{EFDF165C-DCFE-4577-A00F-04691197FB1B} = {81641B0B-BEFB-476D-8519-3774313E944B}
{06F8F677-2696-4996-B4AE-B8E3B747A696} = {65EA04DE-5928-430F-92CA-24C11B6E5A00}
{83C7D129-ACEA-4FC6-A55C-748D8D31135A} = {65EA04DE-5928-430F-92CA-24C11B6E5A00}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3B44FE80-30FE-47B7-A0DE-8610218FFF63}
Expand Down
3 changes: 3 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Target.create "Publish_Solution" (fun _ ->
"StreetNameRegistry.Projections.BackOffice"
"StreetNameRegistry.Projections.Syndication"
"StreetNameRegistry.Snapshot.Verifier"
"StreetNameRegistry.Consumer.Read.Postal"
|] |> Array.Parallel.iter publishSource)

Target.create "Pack_Solution" (fun _ ->
Expand Down Expand Up @@ -95,6 +96,7 @@ Target.create "Containerize" (fun _ ->
{ Project = "StreetNameRegistry.Projections.Syndication"; Container = "projections-syndication" }
{ Project = "StreetNameRegistry.Projections.BackOffice"; Container = "projections-backoffice" }
{ Project = "StreetNameRegistry.Snapshot.Verifier"; Container = "snapshot-verifier" }
{ Project = "StreetNameRegistry.Consumer.Read.Postal"; Container = "consumer-read-postal" }
|] |> Array.Parallel.iter (fun o -> containerize o.Project o.Container))

Target.create "SetAssemblyVersions" (fun _ -> setVersions "SolutionInfo.cs")
Expand All @@ -112,6 +114,7 @@ Target.create "Containerize_MigratorStreetName" (fun _ -> containerize "StreetNa
Target.create "Containerize_ProjectionsSyndication" (fun _ -> containerize "StreetNameRegistry.Projections.Syndication" "projections-syndication")
Target.create "Containerize_ProjectionsBackOffice" (fun _ -> containerize "StreetNameRegistry.Projections.BackOffice" "projections-backoffice")
Target.create "Containerize_SnapshotVerifier" (fun _ -> containerize "StreetNameRegistry.Snapshot.Verifier" "snapshot-verifier")
Target.create "Containerize_ConsumerReadPostal" (fun _ -> containerize "StreetNameRegistry.Consumer.Read.Postal" "consumer-read-postal")
// --------------------------------------------------------------------------------

Target.create "Build" ignore
Expand Down
1 change: 1 addition & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ nuget Be.Vlaanderen.Basisregisters.GrAr.Provenance.AcmIdm 19.0.0
nuget Be.Vlaanderen.Basisregisters.GrAr.Extracts 19.0.0

nuget Be.Vlaanderen.Basisregisters.MessageHandling.AwsSqs.Simple 4.8.3
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer 4.8.3
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer.SqlServer 4.8.3
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Producer 4.8.3
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Simple 4.8.3
Expand Down
5 changes: 5 additions & 0 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ NUGET
AWSSDK.Core (>= 3.7.106.8) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
AWSSDK.SQS (>= 3.7.100.101) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Microsoft.Extensions.Logging (>= 6.0) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer (4.8.3)
Confluent.Kafka (>= 1.8.2) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Microsoft.EntityFrameworkCore (>= 6.0.3) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Microsoft.Extensions.Logging (>= 6.0) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Newtonsoft.Json (>= 13.0.1) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer.SqlServer (4.8.3)
Confluent.Kafka (>= 1.8.2) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Microsoft.EntityFrameworkCore.SqlServer (>= 6.0.3) - restriction: || (&& (== net472) (>= net6.0)) (== net6.0)
Expand Down
1 change: 1 addition & 0 deletions src/EF.MigrationsHelper/EF.MigrationsHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<ProjectReference Include="..\StreetNameRegistry.Api.BackOffice\StreetNameRegistry.Api.BackOffice.csproj" />
<ProjectReference Include="..\StreetNameRegistry.Consumer\StreetNameRegistry.Consumer.csproj" />
<ProjectReference Include="..\StreetNameRegistry.Producer\StreetNameRegistry.Producer.csproj" />
<ProjectReference Include="..\StreetNameRegistry.Consumer.Read.Postal\StreetNameRegistry.Consumer.Read.Postal.csproj" />
<ProjectReference Include="..\StreetNameRegistry.Producer.Snapshot.Oslo\StreetNameRegistry.Producer.Snapshot.Oslo.csproj" />
<ProjectReference Include="..\StreetNameRegistry.Projections.BackOffice\StreetNameRegistry.Projections.BackOffice.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/EF.MigrationsHelper/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"LastChangedListAdmin": "x",
"BackOffice": "x",
"ProducerProjectionsAdmin": "x",
"BackOfficeProjectionsAdmin": "x"
"ConsumerPostalAdmin": "x"
},

"Serilog": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.Infrastructure.Modules
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Api.Exceptions;
using Be.Vlaanderen.Basisregisters.DependencyInjection;
using Consumer.Read.Postal.Infrastructure.Modules;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -35,7 +36,8 @@ protected override void Load(ContainerBuilder builder)
.RegisterModule(new LegacyModule(_configuration, _services, _loggerFactory));

builder
.RegisterModule(new SyndicationModule(_configuration, _services, _loggerFactory));
.RegisterModule(new SyndicationModule(_configuration, _services, _loggerFactory))
.RegisterModule(new ConsumerPostalModule(_configuration, _services, _loggerFactory));

builder
.RegisterType<ProblemDetailsHelper>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace StreetNameRegistry.Api.Legacy.Infrastructure.Modules
{
using Autofac;
using Be.Vlaanderen.Basisregisters.GrAr.Legacy;
using Consumer.Read.Postal;
using FeatureToggles;
using MediatR;
using Microsoft.Extensions.Options;
Expand Down Expand Up @@ -36,13 +37,15 @@ protected override void Load(ContainerBuilder builder)
new ListHandlerV2(
c.Resolve<LegacyContext>(),
c.Resolve<SyndicationContext>(),
c.Resolve<ConsumerPostalContext>(),
c.Resolve<IOptions<ResponseOptions>>());
}

return (IRequestHandler<ListRequest, StreetNameListResponse>)
new ListHandler(
c.Resolve<LegacyContext>(),
c.Resolve<SyndicationContext>(),
c.Resolve<ConsumerPostalContext>(),
c.Resolve<IOptions<ResponseOptions>>());
}).InstancePerLifetimeScope();

Expand Down Expand Up @@ -72,13 +75,16 @@ protected override void Load(ContainerBuilder builder)
return (IRequestHandler<CountRequest, TotaalAantalResponse>)
new CountHandlerV2(
c.Resolve<LegacyContext>(),
c.Resolve<SyndicationContext>());
c.Resolve<SyndicationContext>(),
c.Resolve<ConsumerPostalContext>());
}

return (IRequestHandler<CountRequest, TotaalAantalResponse>)
new CountHandler(
c.Resolve<LegacyContext>(),
c.Resolve<SyndicationContext>());
c.Resolve<SyndicationContext>(),
c.Resolve<ConsumerPostalContext>());

}).InstancePerLifetimeScope();

builder.Register(c =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.Count
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.Api.Search.Pagination;
using Be.Vlaanderen.Basisregisters.GrAr.Legacy;
using Consumer.Read.Postal;
using Microsoft.EntityFrameworkCore;
using Projections.Legacy;
using Projections.Legacy.StreetNameList;
Expand All @@ -15,11 +16,13 @@ public sealed class CountHandler : CountHandlerBase
{
private readonly LegacyContext _legacyContext;
private readonly SyndicationContext _syndicationContext;
private readonly ConsumerPostalContext _postalContext;

public CountHandler(LegacyContext legacyContext, SyndicationContext syndicationContext)
public CountHandler(LegacyContext legacyContext, SyndicationContext syndicationContext, ConsumerPostalContext postalContext)
{
_legacyContext = legacyContext;
_syndicationContext = syndicationContext;
_postalContext = postalContext;
}

public override async Task<TotaalAantalResponse> Handle(CountRequest request, CancellationToken cancellationToken)
Expand All @@ -29,7 +32,7 @@ public override async Task<TotaalAantalResponse> Handle(CountRequest request, Ca
return new TotaalAantalResponse
{
Aantal = request.Filtering.ShouldFilter
? await new StreetNameListQuery(_legacyContext, _syndicationContext)
? await new StreetNameListQuery(_legacyContext, _syndicationContext, _postalContext)
.Fetch<StreetNameListItem, StreetNameListItem>(request.Filtering, request.Sorting, pagination)
.Items
.CountAsync(cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.Count
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.Api.Search.Pagination;
using Be.Vlaanderen.Basisregisters.GrAr.Legacy;
using Consumer.Read.Postal;
using Microsoft.EntityFrameworkCore;
using Projections.Legacy;
using Projections.Legacy.StreetNameListV2;
Expand All @@ -14,11 +15,13 @@ public sealed class CountHandlerV2 : CountHandlerBase
{
private readonly LegacyContext _legacyContext;
private readonly SyndicationContext _syndicationContext;
private readonly ConsumerPostalContext _postalContext;

public CountHandlerV2(LegacyContext legacyContext, SyndicationContext syndicationContext)
public CountHandlerV2(LegacyContext legacyContext, SyndicationContext syndicationContext, ConsumerPostalContext postalContext)
{
_legacyContext = legacyContext;
_syndicationContext = syndicationContext;
_postalContext = postalContext;
}

public override async Task<TotaalAantalResponse> Handle(CountRequest request, CancellationToken cancellationToken)
Expand All @@ -28,7 +31,7 @@ public override async Task<TotaalAantalResponse> Handle(CountRequest request, Ca
return
new TotaalAantalResponse
{
Aantal = await new StreetNameListQueryV2(_legacyContext, _syndicationContext)
Aantal = await new StreetNameListQueryV2(_legacyContext, _syndicationContext, _postalContext)
.Fetch<StreetNameListItemV2, StreetNameListItemV2>(request.Filtering, request.Sorting, pagination)
.Items
.CountAsync(cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.List
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.GrAr.Common;
using Be.Vlaanderen.Basisregisters.GrAr.Legacy;
using Consumer.Read.Postal;
using Convertors;
using Infrastructure.Options;
using Microsoft.EntityFrameworkCore;
Expand All @@ -19,21 +20,24 @@ public sealed class ListHandler : ListHandlerBase
{
private readonly LegacyContext _legacyContext;
private readonly SyndicationContext _syndicationContext;
private readonly ConsumerPostalContext _postalContext;
private readonly IOptions<ResponseOptions> _responseOptions;

public ListHandler(
LegacyContext legacyContext,
SyndicationContext syndicationContext,
ConsumerPostalContext postalContext,
IOptions<ResponseOptions> responseOptions)
{
_legacyContext = legacyContext;
_syndicationContext = syndicationContext;
_postalContext = postalContext;
_responseOptions = responseOptions;
}

public override async Task<StreetNameListResponse> Handle(ListRequest request, CancellationToken cancellationToken)
{
var streetNameQuery = new StreetNameListQuery(_legacyContext, _syndicationContext)
var streetNameQuery = new StreetNameListQuery(_legacyContext, _syndicationContext, _postalContext)
.Fetch<StreetNameListItem, StreetNameListItem>(request.Filtering, request.Sorting, request.Pagination);

var pagedStreetNames = await streetNameQuery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.List
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.GrAr.Common;
using Be.Vlaanderen.Basisregisters.GrAr.Legacy;
using Consumer.Read.Postal;
using Convertors;
using Infrastructure.Options;
using Microsoft.EntityFrameworkCore;
Expand All @@ -19,21 +20,25 @@ public sealed class ListHandlerV2 : ListHandlerBase
{
private readonly LegacyContext _legacyContext;
private readonly SyndicationContext _syndicationContext;
private readonly ConsumerPostalContext _postalContext;

private readonly IOptions<ResponseOptions> _responseOptions;

public ListHandlerV2(
LegacyContext legacyContext,
SyndicationContext syndicationContext,
ConsumerPostalContext postalContext,
IOptions<ResponseOptions> responseOptions)
{
_legacyContext = legacyContext;
_syndicationContext = syndicationContext;
_postalContext = postalContext;
_responseOptions = responseOptions;
}

public override async Task<StreetNameListResponse> Handle(ListRequest request, CancellationToken cancellationToken)
{
var streetNameQuery = new StreetNameListQueryV2(_legacyContext, _syndicationContext)
var streetNameQuery = new StreetNameListQueryV2(_legacyContext, _syndicationContext, _postalContext)
.Fetch<StreetNameListItemV2, StreetNameListItemV2>(request.Filtering, request.Sorting, request.Pagination);

var pagedStreetNames = await streetNameQuery
Expand Down
Loading
Loading