Skip to content

Commit

Permalink
fix: commandhost processors position in projector (#1573)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikdepeuter authored Nov 7, 2024
1 parent 7c21d6a commit 661420b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/RoadRegistry.Hosts/BackOfficeProcessorDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,23 @@ SELECT [Name]
,null as DesiredState
,null as DesiredStateChangedAt
,null as ErrorMessage
FROM [RoadRegistryBackOfficeEventHost].[EventProcessorPosition]
FROM [RoadRegistryBackOfficeEventHost].[EventProcessorPosition] with (nolock)
UNION ALL
SELECT [Name]
,[Position]
,null as DesiredState
,null as DesiredStateChangedAt
,null as ErrorMessage
FROM [RoadRegistryBackOfficeExtractHost].[EventProcessorPosition]
FROM [RoadRegistryBackOfficeExtractHost].[EventProcessorPosition] with (nolock)
UNION ALL
SELECT q.Name
,(q.MaxPosition - (q.MaxStreamVersion - q.Version)) as Position
SELECT cpp.[Name]
,m.Position
,null as DesiredState
,null as DesiredStateChangedAt
,null as ErrorMessage
FROM (
SELECT cpp.[Name]
,cpp.[Version]
,s.Version as MaxStreamVersion
,s.Position as MaxStreamPosition
,(SELECT MAX(Position) FROM [RoadRegistry].Messages) as MaxPosition
FROM [RoadRegistryBackOfficeCommandHost].[CommandProcessorPosition] cpp
JOIN [RoadRegistry].Streams s ON cpp.Name = s.IdOriginal
FROM [RoadRegistryBackOfficeCommandHost].[CommandProcessorPosition] cpp with (nolock)
JOIN [RoadRegistry].Streams s with (nolock) ON cpp.[Name] = s.[IdOriginal]
JOIN [RoadRegistry].Messages m with (nolock) ON s.[IdInternal] = m.[StreamIdInternal] AND cpp.[Version] = m.[StreamVersion]
) q
")
.HasKey(x => x.Name);
Expand Down

0 comments on commit 661420b

Please sign in to comment.