//TODO: add Queue /// <summary> /// Helper to create and start an IFiber by type /// </summary> /// <param name="type"></param> /// <param name="executor"></param> /// <returns></returns> public static IFiber StartNew(FiberType type, IExecutor executor = null) { if (executor == null) executor = new Executor(); IFiber fiber = GetFromTyoe(type, executor); fiber.Start(); return fiber; }
private static IFiber GetFromTyoe(FiberType type, IExecutor executor) { switch (type) { case FiberType.Thread: return new ThreadFiber(executor); case FiberType.Pool: return new PoolFiber(executor); case FiberType.Stub: return new StubFiber(executor); default: throw new ArgumentOutOfRangeException("type"); } }
protected StageBase(FiberType type = FiberType.Pool, IExecutor executor = null) { Fiber = Fibrous.Fiber.StartNew(type, executor); Fiber.Subscribe(In, Receive); }
public FiberBuilderImpl(FiberType type) { _type = type; }
public static IFiberBuilder Create(FiberType type) { return(new FiberBuilderImpl(type)); }
protected UntypedActor(FiberType type = FiberType.Pool) { Fiber = Fibrous.Fiber.StartNew(type, new ExceptionHandlingExecutor(OnError)); Fiber.Subscribe(_tellChannel, Receive); _askChannel.SetRequestHandler(Fiber, OnRequest); }
public Stage(Func <TIn, TOut> f, FiberType type = FiberType.Pool, IExecutor executor = null) : base(type, executor) { _f = f; }
protected AgentBase(FiberType type = FiberType.Pool) { Fiber = Fibrous.Fiber.StartNew(type); _channel = Fiber.NewPublishPort <T>(Handle); }
public RequestAgent(Action <IRequest <TRequest, TReply> > handler, FiberType type = FiberType.Pool) { Fiber = Fibrous.Fiber.StartNew(type); _channel = Fiber.NewRequestPort(handler); }
public Agent(Action <T> handler, FiberType type = FiberType.Pool) { Fiber = Fibrous.Fiber.StartNew(type); _channel = Fiber.NewPublishPort(handler); }
protected ConcurrentComponentBase(IExecutor executor = null, FiberType type = FiberType.Pool) { Fiber = Fibrous.Fiber.StartNew(type, executor); }
public static IFiberBuilder Create(FiberType type) { return new FiberBuilderImpl(type); }
/// <summary> /// Create and start an agent /// </summary> /// <param name="handler"></param> /// <param name="type"></param> /// <returns></returns> public static IAgent <T> Start(Action <T> handler, FiberType type = FiberType.Pool) { return(new Agent <T>(handler, type)); }
public Agent(Action <T> handler, FiberType type = FiberType.Pool) : base(type) { _handler = handler; }
protected RequestAgentBase(FiberType type = FiberType.Pool) { _fiber = Fiber.StartNew(type); _channel = _fiber.NewRequestPort <TRequest, TReply>(Handle); }
public RequestAgent(Action <IRequest <TRequest, TReply> > handler, FiberType type = FiberType.Pool) : base(type) { _handler = handler; }
/// <summary> /// Create and start an agent /// </summary> /// <param name="handler"></param> /// <param name="type"></param> /// <returns></returns> public static IRequestAgent <TRequest, TReply> Start(Action <IRequest <TRequest, TReply> > handler, FiberType type = FiberType.Pool) { return(new RequestAgent <TRequest, TReply>(handler, type)); }
public ChannelAgent(IChannel <T> channel, Action <T> handler, FiberType type = FiberType.Pool) { Fiber = Fibrous.Fiber.StartNew(type); channel.Subscribe(Fiber, handler); }