Created
July 12, 2019 03:02
-
-
Save tocalai/3b56ab703adbcc650663ce0cd92bcbec to your computer and use it in GitHub Desktop.
Grpc client application entry point.
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// same host and port setting as server side | |
var host = "127.0.0.1"; | |
var port = 50052; | |
var channel = new Channel($"{host}:{port}", ChannelCredentials.Insecure); | |
var client = new AlertService.AlertServiceClient(channel); | |
// fire request to server | |
var result = client.SendAlert(new AlertRequest() | |
{ | |
Type = 1, | |
Uid = Guid.NewGuid().ToString(), | |
MsgValue = "Tesing alert message", | |
Severity = 0, | |
DateTime = Timestamp.FromDateTime(DateTime.Now.ToUniversalTime()) | |
}); | |
// receive response and print out | |
Console.WriteLine($"[Alert Response], Ack = {result.Ack}, Stat = {result.ReturnCode}."); | |
channel.ShutdownAsync().Wait(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment