public DispatchableRequest(IListenerReference <TRequest, TResponse> func, Envelope <TRequest> envelope, Guid listenerId, IResponseReceiver <TResponse> request) { _func = func; _envelope = envelope; _request = request; ListenerId = listenerId; }
public IThreadListenerBuilder <TRequest, TResponse> InvokeEnvelope(Func <Envelope <TRequest>, TResponse> listener, bool useWeakReference = false) { Assert.ArgumentNotNull(listener, nameof(listener)); ValidateDoesNotAlreadyHaveAction(); _funcReference = CreateReference(listener, useWeakReference); return(this); }
public IThreadListenerBuilder <TRequest, TResponse> ActivateAndInvoke <TService>(Func <TRequest, TService> createService, Func <TService, TRequest, TResponse> handler, bool cacheService = true) where TService : class { Assert.ArgumentNotNull(createService, nameof(createService)); Assert.ArgumentNotNull(handler, nameof(handler)); ValidateDoesNotAlreadyHaveAction(); _funcReference = new ActivatedListenerReference <TRequest, TResponse, TService>(createService, handler, cacheService); return(this); }
private IListener <TRequest, TResponse> CreateListener(IListenerReference <TRequest, TResponse> reference, DispatchThreadType dispatchType, int threadId) { switch (dispatchType) { case DispatchThreadType.NoPreference: return(new AnyThreadListener <TRequest, TResponse>(reference, _workerPool)); case DispatchThreadType.AnyWorkerThread: return(new AnyThreadListener <TRequest, TResponse>(reference, _workerPool)); case DispatchThreadType.SpecificThread: return(new SpecificThreadListener <TRequest, TResponse>(reference, threadId, _workerPool)); case DispatchThreadType.Immediate: return(new ImmediateListener <TRequest, TResponse>(reference)); case DispatchThreadType.ThreadpoolThread: return(new ThreadPoolListener <TRequest, TResponse>(reference, _workerPool)); default: return(new ImmediateListener <TRequest, TResponse>(reference)); } }
public AnyThreadListener(IListenerReference <TRequest, TResponse> func, IWorkerPool workerPool) { _func = func; _workerPool = workerPool; }
public ImmediateListener(IListenerReference <TRequest, TResponse> func) { _func = func; }
public SpecificThreadListener(IListenerReference <TRequest, TResponse> func, int threadId, IWorkerPool workerPool) { _func = func; _threadId = threadId; _workerPool = workerPool; }