Add initial implementation of RbbitMQ

This commit is contained in:
fiodarsazanavets
2026-01-31 20:11:59 +00:00
parent 1c1dc2edc5
commit 38ee857784
104 changed files with 64271 additions and 1 deletions
@@ -0,0 +1,38 @@
using Microsoft.AspNetCore.SignalR;
namespace OnlineShop.ApiService;
public class LocationUpdater(
IHubContext<LocationHub> locationHub) :
BackgroundService
{
protected async override Task
ExecuteAsync(
CancellationToken cancellationToken)
{
await Task.Delay(5000, cancellationToken);
await UpdateLocation(
51.5074, -0.1276, cancellationToken);
await Task.Delay(5000, cancellationToken);
await UpdateLocation(
51.5074, -0.13, cancellationToken);
await Task.Delay(5000, cancellationToken);
await UpdateLocation(
51.508, -0.14, cancellationToken);
}
private async Task UpdateLocation(
double latitude,
double longitude,
CancellationToken cancellationToken)
{
await locationHub.Clients.All.SendAsync(
"ReceiveLocationUpdate",
latitude,
longitude,
cancellationToken);
}
}