-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push support for Connectors via server sent events (#691)
* feat: add SseServer project * fix: don't raise domain event in FinalizeSyncRun Handler * feat: only trigger one DatawalletModifiedDomainEvent, no matter how many modifications were added * fix: use string for properties in DatawalletModifiedDomainEvent * chore: move TraceIdMiddleware.cs to BuildingBlocks.API * chore: formatting * feat: add JwtSigningCertificate to ConsumerApi appsettings.override.json * chore: remove RequestResponseTimeMiddleware ResponseDurationMiddleware from ConsumerApi and use the ones from BuildingBlocks isntead * feat: implement SseServer * feat: add SseConnector * chore: throw NotSupportedException instead of NotImplementedException in various places * chore: cleanup Configuration.cs * chore: formatting * feat: make JwtSigningCertificate config required * refactor: extract method to get push notification name into extension method * feat: catch exception during send in SseServerClient * feat: only send event name * chore: enable SSE for local development * refactor: extract extension method * chore: improve folder structure * fix: don't add success if there is no success * refactor: add ISseServerClient * test: add SseConnectorTests.cs * test: introduce BeEquivalentToJson extension method * refactor: extract request building logic into SseMessageBuilder * chore: introduce log event ids * refactor: rename SseConnector to ServerSentEventsConnector * chore: move SseServer project to "SseServer/src" folder * test: add tests for EventQueue * chore: rename database health checks from "<moduleName>" to "<moduleName>Database" * feat: add health check to SseServer * feat: add SseServer health check to Consumer API health check * feat: add Dockerfile for SseServer * chore: add SseServer to Backbone.run.xml * ci: add sse server to build and publish pipelines * chore: make buildContainerImage.js script executable * chore: fix formatting * test: fix test * feat: add sseserver to helm chart * ci: add sse server to docker-compose.test.yml * chore: minor changes * feat: only enable sse health check if sse is enabled * ci: add JwtSigningCertificate to pipeline configs * feat: only create sse resources if sse provider is enabled in config * test: import FluentAssertions.Json in StringAssertionsExtensions to make the tests work * test: cleanup * test: remove unused code * chore: add local logging overrides for eventhandlerservice * chore: explicitly AllowAnonymous for "/{address}/events" route * chore: remove redundant configuration from sseserver's appsettings.json * feat: make Modules property in SseServer's configuration required * chore: remove commented out code * chore: add explaining comments to the call of the UpdateDeviceRegistrationCommand * ci: fix job name * fix: remove publishing of TierOfIdentityChangedDomainEvent from Handlers
- Loading branch information
Showing
101 changed files
with
2,033 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env node | ||
|
||
import { $ } from "zx"; | ||
import { getRequiredEnvVar } from "../lib.js"; | ||
|
||
const tag = getRequiredEnvVar("TAG"); | ||
|
||
const platforms = process.env.PLATFORMS ?? "linux/amd64,linux/arm64"; | ||
const push = process.env.PUSH === "1" ? ["--push", "--provenance=true", "--sbom=true"] : ""; | ||
|
||
await $`docker buildx build --file ./SseServer/src/SseServer/Dockerfile --tag ghcr.io/nmshd/backbone-sse-server:${tag} --platform ${platforms} ${push} .`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,7 +165,7 @@ jobs: | |
PUSH: 1 | ||
|
||
publish-identity-deletion-jobs: | ||
name: Publish Identity Deletion Jobs Image | ||
name: Publish Identity Deletion Jobs Container Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -195,6 +195,37 @@ jobs: | |
TAG: ${{ github.ref_name }} | ||
PUSH: 1 | ||
|
||
publish-sse-server: | ||
name: Publish SSE Server Container Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install script dependencies | ||
run: npm install --prefix ./.ci | ||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Log in to Docker Hub for accessing the cloud builder | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.CLOUD_BUILDER_USERNAME }} | ||
password: ${{ secrets.CLOUD_BUILDER_TOKEN }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: "lab:latest" | ||
driver: cloud | ||
endpoint: "jssoft/js-soft" | ||
- name: Build and Push Container Image | ||
run: ./.ci/sses/buildContainerImage.js | ||
env: | ||
TAG: ${{ github.ref_name }} | ||
PUSH: 1 | ||
|
||
publish-helm-chart: | ||
name: Publish Helm Chart | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="SSE Server" type="LaunchSettings" factoryName=".NET Launch Settings Profile"> | ||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/SseServer/src/SseServer/SseServer.csproj"/> | ||
<option name="LAUNCH_PROFILE_TFM" value="net8.0"/> | ||
<option name="LAUNCH_PROFILE_NAME" value="Default"/> | ||
<option name="USE_EXTERNAL_CONSOLE" value="0"/> | ||
<option name="USE_MONO" value="0"/> | ||
<option name="RUNTIME_ARGUMENTS" value=""/> | ||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1"/> | ||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0"/> | ||
<option name="SEND_DEBUG_REQUEST" value="1"/> | ||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value=""/> | ||
<method v="2"> | ||
<option name="Build"/> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...erApi/Mvc/Middleware/TraceIdMiddleware.cs → ...s.API/Mvc/Middleware/TraceIdMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
BuildingBlocks/src/BuildingBlocks.Application/PushNotifications/IPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
namespace Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
public interface IPushNotification; | ||
|
||
public static class IPushNotificationExtensions | ||
{ | ||
private const string PUSH_NOTIFICATION_POSTFIX = "PushNotification"; | ||
|
||
public static string GetEventName(this IPushNotification pushNotification) | ||
{ | ||
var notificationTypeName = pushNotification.GetType().Name; | ||
|
||
if (notificationTypeName.Contains(PUSH_NOTIFICATION_POSTFIX)) | ||
return notificationTypeName.Replace(PUSH_NOTIFICATION_POSTFIX, ""); | ||
|
||
return "dynamic"; | ||
} | ||
} |
Oops, something went wrong.