Skip to content

Instantly share code, notes, and snippets.

@JIntrocaso
Created January 25, 2022 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JIntrocaso/8b0afe33607c2c49ab0b79124f80d306 to your computer and use it in GitHub Desktop.
Save JIntrocaso/8b0afe33607c2c49ab0b79124f80d306 to your computer and use it in GitHub Desktop.
Consume Method
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