mirror of
https://github.com/AlexMacocian/MTSC.git
synced 2026-07-24 12:06:38 +00:00
e5ccfff5da
- introduced handler affinity to let handlers claim a client and prevent other handlers from receiving messages from the client - Httproutinghandler will route based on headers without loading the entire message
24 lines
740 B
C#
24 lines
740 B
C#
using MTSC.Common;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MTSC.ServerSide.Schedulers
|
|
{
|
|
public class ParallelScheduler : IScheduler
|
|
{
|
|
void IScheduler.ScheduleHandling(List<(ClientData, IConsumerQueue<Message>)> clientsQueues, Action<ClientData, IConsumerQueue<Message>> messageHandlingProcedure)
|
|
{
|
|
List<Action> actionList = new List<Action>();
|
|
|
|
foreach(var tuple in clientsQueues)
|
|
{
|
|
(var client, var messageQueue) = tuple;
|
|
actionList.Add(new Action(() => messageHandlingProcedure.Invoke(client, messageQueue)));
|
|
}
|
|
|
|
Parallel.Invoke(actionList.ToArray());
|
|
}
|
|
}
|
|
}
|