Created
January 25, 2022 02:46
-
-
Save JIntrocaso/8b0afe33607c2c49ab0b79124f80d306 to your computer and use it in GitHub Desktop.
Consume Method
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
consumer.Received += (model, ea) => | |
{ | |
var body = ea.Body.ToArray(); | |
var message = Encoding.UTF8.GetString(body); | |
var notification = JsonSerializer.Deserialize<Notification>(message); | |
var senderName = notification?.Properties?.GetValueOrDefault("SenderName"); | |
Console.WriteLine($"Received event: {notification?.Event} Sent by: {senderName}"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment