Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public object GetNextMessage(CancellationToken stopToken)
- {
- CancellationToken timerToken = new CancellationToken();
- timerToken.Register(() => {
- //trigger a heartbeat message instead?
- });
- CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(timerToken, timerToken);
- uint halfHour = (uint)(new TimeSpan(0, 30, 0)).TotalMilliseconds;
- Timer t = new Timer((s) =>
- {
- cts.Cancel();
- },null,halfHour,-1);
- return myMessage =_queue.Dequeue(cts.Token)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement