Created
November 18, 2019 11:53
-
-
Save cilliemalan/a10c3f8c3d7a1b97989b5680442eb1f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 class MyBackgroundService : BackgroundService | |
{ | |
protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
{ | |
using var disposer = messageQueue.Subscribe(async (msg) => | |
{ | |
await ProcessMessageAsync(msg, stoppingToken); | |
}); | |
// Nasty! | |
while (!stoppingToken.IsCancellationRequested) | |
{ | |
await Task.Delay(1000000, stoppingToken); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment