public ServerRequestResponseChannelActor( IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) { _name = name; _port = port; var requestBufferPool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(maxBufferPoolSize), maxMessageSize); _processors = StartProcessors(provider, name, processorPoolSize, requestBufferPool, probeInterval, probeTimeout); try { Logger.Info($"{GetType().Name}: OPENING PORT: {port}"); _channel = new Socket(SocketType.Stream, ProtocolType.Tcp); _channel.Bind(new IPEndPoint(IPAddress.Any, port)); _channel.Listen(120); } catch (Exception e) { Logger.Error($"Failure opening socket because: {e.Message}", e); throw; } _cancellable = Stage.Scheduler.Schedule(SelfAs <IScheduled <object?> >(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(probeInterval)); }
protected abstract IServerRequestResponseChannel GetServer( Stage stage, IRequestChannelConsumerProvider provider, string name, int testPort, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout);
protected override IServerRequestResponseChannel GetServer(Stage stage, IRequestChannelConsumerProvider provider, string name, int testPort, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) => ServerRequestResponseChannelFactory.Start( stage, provider, testPort, "test-server", processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout);
public static IServerRequestResponseChannel Start( Stage stage, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) => stage.ActorFor <IServerRequestResponseChannel>( () => new ServerRequestResponseChannelActor(provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout));
public IServerRequestResponseChannel Start(Stage stage, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval) { return(ServerRequestResponseChannelFactory.Start( stage, provider, port, name, processorPoolSize, maxMessageSize, maxMessageSize, probeInterval)); }
public SocketChannelSelectionProcessorActor( IRequestChannelConsumerProvider provider, string name, int maxBufferPoolSize, int messageBufferSize, long probeInterval) { _provider = provider; _name = name; _messageBufferSize = messageBufferSize; _responder = SelfAs <IResponseSenderChannel <Socket> >(); _cancellable = Stage.Scheduler.Schedule(SelfAs <IScheduled <object> >(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(probeInterval)); }
public static IServerRequestResponseChannel Start( Stage stage, IAddress address, string mailboxName, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) => stage.ActorFor <IServerRequestResponseChannel>( () => new ServerRequestResponseChannelActor(provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout), mailboxName, address.Name, address, stage.World.DefaultLogger);
public SocketChannelSelectionProcessorActor( IRequestChannelConsumerProvider provider, string name, IResourcePool <IConsumerByteBuffer, string> requestBufferPool, long probeInterval, long probeTimeout) { _provider = provider; _name = name; _requestBufferPool = requestBufferPool; _probeTimeout = probeTimeout; _contexts = new List <Context>(); _responder = SelfAs <IResponseSenderChannel>(); _cancellable = Stage.Scheduler.Schedule(SelfAs <IScheduled <object?> >(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(probeInterval)); }
IServerRequestResponseChannel IServerRequestResponseChannel.Start( Stage stage, IAddress address, string mailboxName, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) { return(ServerRequestResponseChannelFactory.Start(stage, address, mailboxName, provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout)); }
private ISocketChannelSelectionProcessor[] StartProcessors( IRequestChannelConsumerProvider provider, string name, int processorPoolSize, IResourcePool <IConsumerByteBuffer, string> requestBufferPool, long probeInterval, long probeTimeout) { var processors = new ISocketChannelSelectionProcessor[processorPoolSize]; for (var idx = 0; idx < processors.Length; ++idx) { processors[idx] = ChildActorFor <ISocketChannelSelectionProcessor>( () => new SocketChannelSelectionProcessorActor(provider, $"{name}-processor-{idx}", requestBufferPool, probeInterval, probeTimeout)); } return(processors); }
public static IServerRequestResponseChannel Start( Stage stage, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval) { var parameters = Definition.Parameters(provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval); var channel = stage.ActorFor <IServerRequestResponseChannel>( Definition.Has <ServerRequestResponseChannelActor>(parameters)); return(channel); }
private ISocketChannelSelectionProcessor[] StartProcessors( IRequestChannelConsumerProvider provider, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval) { var processors = new ISocketChannelSelectionProcessor[processorPoolSize]; for (int idx = 0; idx < processors.Length; ++idx) { processors[idx] = ChildActorFor <ISocketChannelSelectionProcessor>( Definition.Has <SocketChannelSelectionProcessorActor>( Definition.Parameters(provider, $"{name}-processor-{idx}", maxBufferPoolSize, maxMessageSize, probeInterval))); } return(processors); }
public static IServerRequestResponseChannel Start( Stage stage, IAddress address, string mailboxName, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) { var parameters = Definition.Parameters(provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout); var channel = stage.ActorFor <IServerRequestResponseChannel>( Definition.Has <ServerRequestResponseChannelActor>(parameters, mailboxName, address.Name), address, stage.World.DefaultLogger); return(channel); }