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)); }
public ServerActor( Resources resources, Filters filters, int port, Configuration.SizingConf sizing, Configuration.TimingConf timing, string channelMailboxTypeName) { var start = DateExtensions.GetCurrentMillis(); _filters = filters; _dispatcherPoolIndex = 0; _world = Stage.World; _requestsMissingContent = new Dictionary <string, RequestResponseHttpContext>(); _maxMessageSize = sizing.MaxMessageSize; try { _responseBufferPool = new ConsumerByteBufferPool( ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(sizing.MaxBufferPoolSize), sizing.MaxMessageSize); _dispatcherPool = new IDispatcher[sizing.DispatcherPoolSize]; for (int idx = 0; idx < sizing.DispatcherPoolSize; ++idx) { _dispatcherPool[idx] = Dispatcher.StartWith(Stage, resources); } _channel = ServerRequestResponseChannelFactory.Start( Stage, Stage.World.AddressFactory.WithHighId(ChannelName), channelMailboxTypeName, this, port, ChannelName, sizing.ProcessorPoolSize, sizing.MaxBufferPoolSize, sizing.MaxMessageSize, timing.ProbeInterval, timing.ProbeTimeout); var end = DateExtensions.GetCurrentMillis(); Logger.Info($"Server {ServerName} is listening on port: {port} started in {end - start} ms"); _requestMissingContentTimeout = timing.RequestMissingContentTimeout; LogResourceMappings(resources); } catch (Exception e) { var message = $"Failed to start server because: {e.Message}"; Logger.Error(message, e); throw new InvalidOperationException(message); } }
public OutboundTest(ITestOutputHelper output) { var converter = new Converter(output); Console.SetOut(converter); _pool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(10), 1024); _channelProvider = new MockManagedOutboundChannelProvider(Id.Of(1), Config); _outbound = new Xoom.Wire.Fdx.Outbound.Outbound(_channelProvider, new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(10), 10_000)); }
public static IOperationalOutboundStream Instance( Stage stage, Node node, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var operationalOutboundStream = stage.ActorFor <IOperationalOutboundStream>(() => new OperationalOutboundStreamActor(node, provider, byteBufferPool), "cluster-operational-outbound-stream"); return(operationalOutboundStream); }
public static IApplicationOutboundStream Instance( Stage stage, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var applicationOutboundStream = stage.ActorFor <IApplicationOutboundStream>( () => new ApplicationOutboundStreamActor(provider, byteBufferPool), "application-outbound-stream"); return(applicationOutboundStream); }
public static IApplicationOutboundStream Instance( Stage stage, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var definition = Definition.Has <ApplicationOutboundStreamActor>( Definition.Parameters(provider, byteBufferPool), "application-outbound-stream"); var applicationOutboundStream = stage.ActorFor <IApplicationOutboundStream>(definition); return(applicationOutboundStream); }
public ApplicationOutboundStreamTest(ITestOutputHelper output) : base(output) { _world = TestWorld.Start("test-outbound-stream"); var localNodeId = Id.Of(1); _channelProvider = new MockManagedOutboundChannelProvider(localNodeId, Config); var pool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(10), Properties.OperationalBufferSize()); _outboundStream = _world.ActorFor <IApplicationOutboundStream>( () => new ApplicationOutboundStreamActor(_channelProvider, pool)); }
public static IOperationalOutboundStream Instance( Stage stage, Node node, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var definition = Definition.Has <OperationalOutboundStreamActor>( Definition.Parameters(node, provider, byteBufferPool), "cluster-operational-outbound-stream"); var operationalOutboundStream = stage.ActorFor <IOperationalOutboundStream>(definition); return(operationalOutboundStream); }
public BasicClientRequestResponseChannel( Address address, IResponseChannelConsumer consumer, int maxBufferPoolSize, int maxMessageSize, ILogger logger) { _address = address; _consumer = consumer; _logger = logger; _closed = false; _channel = null; _previousPrepareFailures = 0; _readBufferPool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(maxBufferPoolSize), maxMessageSize); _connectDone = new AutoResetEvent(false); }
public OperationalOutboundStreamTest(ITestOutputHelper output) : base(output) { _world = TestWorld.Start("test-outbound-stream"); _localNodeId = Id.Of(1); _localNode = Config.NodeMatching(_localNodeId); _channelProvider = new MockManagedOutboundChannelProvider(_localNodeId, Config); var pool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, Nothing> .Config.Of(10), Properties.OperationalBufferSize()); _outboundStream = _world.ActorFor <IOperationalOutboundStream>( Definition.Has <OperationalOutboundStreamActor>(Definition.Parameters(_localNode, _channelProvider, pool))); }
public ConfirmingDistributorTest(ITestOutputHelper output) : base(output) { _localNodeId = Id.Of(1); _localNode = Config.NodeMatching(_localNodeId); _set = AttributeSet.Named("test-set"); _tracked = _set.AddIfAbsent(Attribute <string> .From("test-attr", "test-value")); _channelProvider = new MockManagedOutboundChannelProvider(_localNodeId, Config); var pool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(10), Properties.OperationalBufferSize()); var outboundStream = TestWorld.ActorFor <IOperationalOutboundStream>( () => new OperationalOutboundStreamActor(_localNode, _channelProvider, pool)); _confirmingDistributor = new ConfirmingDistributor(Application, _localNode, outboundStream.Actor, Config); }
public AttributesAgentActorTest(ITestOutputHelper output) : base(output) { _localNodeId = Id.Of(1); _localNode = Config.NodeMatching(_localNodeId); _set = AttributeSet.Named("test-set"); _tracked = _set.AddIfAbsent(Attribute <string> .From("test-attr", "test-value")); _channelProvider = new MockManagedOutboundChannelProvider(_localNodeId, Config); var pool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, Nothing> .Config.Of(10), Properties.OperationalBufferSize()); _interest = new MockConfirmationInterest(); _outboundStream = TestWorld.ActorFor <IOperationalOutboundStream>( Definition.Has <OperationalOutboundStreamActor>( Definition.Parameters(_localNode, _channelProvider, pool))); }
public void SetPool(ConsumerByteBufferPool pool) => _pool = pool;
public ApplicationOutboundStreamActor(IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { _outbound = new Outbound(provider, byteBufferPool); }
public OperationalOutboundStreamActor(Node node, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { _node = node; _outbound = new Outbound(provider, byteBufferPool); _cache = new OperationalMessageCache(node); }
public Outbound(IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { _provider = provider; _pool = byteBufferPool; }
public OutboundTest(ITestOutputHelper output) : base(output) { _pool = new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(10), Properties.OperationalBufferSize()); _channelProvider = new MockManagedOutboundChannelProvider(Id.Of(1), Config); _outbound = new Xoom.Wire.Fdx.Outbound.Outbound(_channelProvider, new ConsumerByteBufferPool(ElasticResourcePool <IConsumerByteBuffer, string> .Config.Of(10), 10_000)); }