-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example endpoint to connect with the database
- Loading branch information
Showing
9 changed files
with
65 additions
and
48 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 was deleted.
Oops, something went wrong.
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,16 @@ | ||
syntax = "proto3"; | ||
|
||
option csharp_namespace = "MantaRayPlan"; | ||
|
||
package messagebus; | ||
|
||
import "google/protobuf/empty.proto"; | ||
|
||
service MessageBusService { | ||
rpc GetStatus (google.protobuf.Empty) returns (MessageBusStatusReply); | ||
} | ||
|
||
message MessageBusStatusReply { | ||
string message = 1; | ||
int32 counter = 2; | ||
} |
22 changes: 0 additions & 22 deletions
22
src/Server.Controllers.Api.Grpc/Services/GreeterService.cs
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
src/Server.Controllers.Api.Grpc/Services/MessageBusServiceProxy.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Google.Protobuf.WellKnownTypes; | ||
using Grpc.Core; | ||
using MadWorldNL.MantaRayPlan.MessageBuses; | ||
using MantaRayPlan; | ||
|
||
namespace MadWorldNL.MantaRayPlan.Services; | ||
|
||
public class MessageBusServiceProxy(IMessageBusRepository messageBusRepository, ILogger<MessageBusServiceProxy> logger) | ||
: MessageBusService.MessageBusServiceBase | ||
{ | ||
public override async Task<MessageBusStatusReply> GetStatus(Empty request, ServerCallContext context) | ||
{ | ||
try | ||
{ | ||
var status = await messageBusRepository.FindStatusAsync() ?? new MessageBusStatus(); | ||
|
||
return new MessageBusStatusReply() | ||
{ | ||
Counter = status.Count | ||
}; | ||
} | ||
catch (Exception ex) | ||
{ | ||
const string message = "Database error"; | ||
|
||
logger.LogError(ex, message); | ||
|
||
return new MessageBusStatusReply() | ||
{ | ||
Message = message | ||
}; | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
}, | ||
"Kestrel": { | ||
"EndpointDefaults": { | ||
"Protocols": "Http1AndHttp2" | ||
"Protocols": "Http2" | ||
} | ||
} | ||
} |
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