Skip to content

Commit

Permalink
Registering for server sent events fails with status 500 (#716)
Browse files Browse the repository at this point in the history
* fix: add eventbus configuration

* fix: register eventbus in service collection
  • Loading branch information
tnotheis authored Jun 26, 2024
1 parent cd92fba commit c473bf4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SseServer/src/SseServer/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Backbone.Infrastructure.EventBus;
using DevicesConfiguration = Backbone.Modules.Devices.ConsumerApi.Configuration;

namespace Backbone.SseServer;
Expand All @@ -8,6 +9,9 @@ public class Configuration
[Required]
public AuthenticationConfiguration Authentication { get; set; } = new();

[Required]
public InfrastructureConfiguration Infrastructure { get; set; } = new();

[Required]
public ModulesConfiguration Modules { get; set; } = new();

Expand All @@ -16,6 +20,12 @@ public class AuthenticationConfiguration
public string JwtSigningCertificate { get; set; } = "";
}

public class InfrastructureConfiguration
{
[Required]
public EventBusConfiguration EventBus { get; set; } = new();
}

public class ModulesConfiguration
{
[Required]
Expand Down
3 changes: 3 additions & 0 deletions SseServer/src/SseServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Backbone.BuildingBlocks.API.Mvc.Middleware;
using Backbone.BuildingBlocks.Application.QuotaCheck;
using Backbone.BuildingBlocks.Infrastructure.Persistence.Database;
using Backbone.Infrastructure.EventBus;
using Backbone.Modules.Devices.ConsumerApi;
using Backbone.Modules.Devices.Infrastructure.PushNotifications;
using Backbone.SseServer.Controllers;
Expand Down Expand Up @@ -106,6 +107,8 @@ static void ConfigureServices(IServiceCollection services, IConfiguration config

services.AddScoped<IQuotaChecker, AlwaysSuccessQuotaChecker>();

services.AddEventBus(parsedConfiguration.Infrastructure.EventBus);

services.AddHealthChecks();

services.Configure<ForwardedHeadersOptions>(options =>
Expand Down
5 changes: 5 additions & 0 deletions SseServer/src/SseServer/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"AllowedHosts": "*",
"Infrastructure": {
"EventBus": {
"SubscriptionClientName": "ConsumerApi"
}
},
"Modules": {
"Devices": {
"Application": {
Expand Down
13 changes: 13 additions & 0 deletions SseServer/src/SseServer/appsettings.override.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
"JwtSigningCertificate": "MIIJ7wIBAzCCCaUGCSqGSIb3DQEHAaCCCZYEggmSMIIJjjCCBAIGCSqGSIb3DQEHBqCCA/MwggPvAgEAMIID6AYJKoZIhvcNAQcBMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAiIVEGIEnzbyAICCAAwDAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEC1tOaulJJjkAl2W7xeF3G6AggOAm1VdXzAQ6MhHabp6+rzEuaAyBpuMi8zD8OEl8/xMv47UsFUor38aZjQd14qTTLz5MnksI/qgjQHLuMEmN1eWARsUBkeYvLuz0icl2q9A5Rn9CaKHIemQWq9mIobq3XnXhwDFEd+G/WgjNoK65Ndu20pnuc9LDlfq6fx2eXDbHAWLeUTnlQsEY4M/owNKIjlO/VsYJCshvEPlbtCnyzXwkrtQ5i2XufIJsfX0qoK/dXfoMVUjPxa/L8uR40bAWc1LVkvO0Ox4rY9VCtC1eHe3fcS48AaYCGRMpkZ7N+nDOb7lPs7BcxVoIrj/PkqiNI4rMOZVEgz21OWhueIjBv4gxfV+vW7IZ7xWvC1uUYIKEKEl6mk8KJ5zruO3tObX70+4saBiTNd/76+CVR4qCSwYcD7bZjpMOiaVFyxy0ay3dCwoivLK1jWNFJ25tngYpXKGCtOP0/Zi1fyseo4C54Ef5Yoo+BG3bkKR9VHChWzbB+b1p2lOwfBWIWlGjoZ+expyBjnk+FWrFDZeMknpW3PANCtcT/zqzqPKG3g4DAnSx9xDqvR7GBEgUlaUBAsCM3NvbahzevFFNE21aVajmTpSdejqvgNgvHPHA+BHfhMYx3mcMEkZ+phEHrWRSg925Iy64afL9/X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WWsn3Oe+h4mn3wT9+P+hkAR9duXT6tq+5DmKB2RD3fR3vIc4H5eLaIzOOmjSdfGFvIaj+06jS7SGicuKqF5ND4HPtXJrQgQUdO/gIHCkE9nn4hXCoz/bGkU4FN2WPz5TTMVsYuxMVp1I2UayoQppltkp3oaDb/S36FeO644d5zb7ARayF68NL5MrM/MRK24jhtx2WV4ZN9HIxJTAjBgkqhkiG9w0BCRUxFgQU/S6zDu6S3P4i1WdDz+j3esGxT4UwQTAxMA0GCWCGSAFlAwQCAQUABCCiOwVWGDHil8dA7XvoQNTLTJDm7EwdfGC4KJUV9smgUgQI4ZRrDNXXl8cCAggA",
"JwtLifetimeInSeconds": 300
},
"Infrastructure": {
"EventBus": {
"Vendor": "RabbitMQ", // possible values: InMemory, RabbitMQ, GoogleCloud, Azure
"ConnectionInfo": "localhost",

"RabbitMQUsername": "guest", // only available for RabbitMQ
"RabbitMQPassword": "guest", // only available for RabbitMQ
"ConnectionRetryCount": 5, // only available for RabbitMQ

"GcpPubSubProjectId": "", // only available for Google Cloud Pub/Sub
"GcpPubSubTopicName": "" // only available for Google Cloud Pub/Sub
}
},
"Modules": {
"Devices": {
"Infrastructure": {
Expand Down

0 comments on commit c473bf4

Please sign in to comment.