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}"); | |
}; |
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
using System.Text.Json.Serialization; | |
namespace Receiver.Models | |
{ | |
public class Notification | |
{ | |
public Guid MessageId { get; set; } | |
public DateTime Timestamp { get; set; } | |
public string Sender { get; set; } = "None Sent"; | |
public string Event { get; set; } = string.Empty; |
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
public getAPIEndpoint() { | |
this.httpClient.get("https://api.ipify.org?format=json").subscribe(response => { | |
console.log(response); | |
this.ipAddress = response["ip"]; | |
}); | |
} | |
public getGeoEndpoint() { | |
this.httpClient.get("https://geo.ipify.org/api/v1?apiKey=" + this.apiKey).subscribe(response => { | |
console.log(response); |