public SpecificThreadParticipant(IParticipantReference <TRequest, TResponse> func, int threadId, IWorkerPool workerPool, string name) { _func = func; _threadId = threadId; _workerPool = workerPool; _name = name; }
public DispatchableScatter(IParticipantReference <TRequest, TResponse> func, Envelope <TRequest> request, Guid participantId, string name, IGatherReceiver <TResponse> scatter) { _func = func; _request = request; _name = name; _scatter = scatter; ParticipantId = participantId; }
public IThreadParticipantBuilder <TRequest, TResponse> InvokeEnvelope(Func <Envelope <TRequest>, TResponse> participant, bool useWeakReference = false) { Assert.ArgumentNotNull(participant, nameof(participant)); ValidateDoesNotAlreadyHaveAction(); var reference = CreateReference(participant, useWeakReference); _funcReference = reference; return(this); }
public ThreadPoolParticipant(IWorkerPool workerPool, IParticipantReference <TRequest, TResponse> action, string name) { Assert.ArgumentNotNull(workerPool, nameof(workerPool)); Assert.ArgumentNotNull(action, nameof(action)); _workerPool = workerPool; _action = action; _name = name; }
public static void GetResponses(Guid id, IParticipantReference <TRequest, TResponse> func, Envelope <TRequest> request, IGatherReceiver <TResponse> scatter, string name) { try { var response = func.Invoke(request); scatter.AddResponse(id, ScatterResponse <TResponse> .Success(id, name, response)); } catch (Exception e) { scatter.AddResponse(id, ScatterResponse <TResponse> .Error(id, name, e)); } }
private IParticipant <TRequest, TResponse> CreateParticipant(IParticipantReference <TRequest, TResponse> reference, DispatchThreadType dispatchType, int threadId, string name) { switch (dispatchType) { case DispatchThreadType.NoPreference: return(new AnyThreadParticipant <TRequest, TResponse>(reference, _workerPool, name)); case DispatchThreadType.AnyWorkerThread: return(new AnyThreadParticipant <TRequest, TResponse>(reference, _workerPool, name)); case DispatchThreadType.SpecificThread: return(new SpecificThreadParticipant <TRequest, TResponse>(reference, threadId, _workerPool, name)); case DispatchThreadType.ThreadpoolThread: return(new ThreadPoolParticipant <TRequest, TResponse>(_workerPool, reference, name)); case DispatchThreadType.Immediate: return(new ImmediateParticipant <TRequest, TResponse>(reference, name)); default: return(new ImmediateParticipant <TRequest, TResponse>(reference, name)); } }
public AnyThreadParticipant(IParticipantReference <TRequest, TResponse> func, IWorkerPool workerPool, string name) { _func = func; _workerPool = workerPool; _name = name; }
public ImmediateParticipant(IParticipantReference <TRequest, TResponse> func, string name) { _func = func; _name = name; }