Example #1
0
        public IServer StartWith(Stage stage,
                                 Resources resources, int port, Configuration.SizingConf sizing,
                                 Configuration.TimingConf timing)
        {
            if (!_actor.IsStopped)
            {
                Action <IServer> cons128873 = __ =>
                                              __.StartWith(stage, resources, port, sizing, timing);
                if (_mailbox.IsPreallocated)
                {
                    _mailbox.Send(_actor, cons128873, null, StartWithRepresentation3);
                }
                else
                {
                    _mailbox.Send(new LocalMessage <IServer>(_actor, cons128873,
                                                             StartWithRepresentation3));
                }
            }
            else
            {
                _actor.DeadLetters?.FailedDelivery(new DeadLetter(_actor, StartWithRepresentation3));
            }

            return(null !);
        }
Example #2
0
        public ServerActor(
            Resources resources,
            Filters filters,
            int port,
            Configuration.SizingConf sizing,
            Configuration.TimingConf timing,
            string channelMailboxTypeName)
        {
            var start = DateExtensions.GetCurrentMillis();

            _filters = filters;
            _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 ServerDispatcherPool(Stage, resources, sizing.DispatcherPoolSize);

                _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);
            }
        }
Example #3
0
 public IServer StartWith(Stage stage, Resources resources, Filters filters, int port,
                          Configuration.SizingConf sizing, Configuration.TimingConf timing,
                          string severMailboxTypeName, string channelMailboxTypeName) =>
 ServerFactory.StartWith(stage, resources, filters, port, sizing, timing);
Example #4
0
 public IServer StartWith(Stage stage, Resources resources, Filters filters, int port,
                          Configuration.SizingConf sizing, Configuration.TimingConf timing) =>
 ServerFactory.StartWith(stage, resources, filters, port, sizing, timing);
Example #5
0
        public static IServer StartWith(Stage stage, Resources resources, Filters filters, int port, Configuration.SizingConf sizing, Configuration.TimingConf timing, string severMailboxTypeName, string channelMailboxTypeName)
        {
            var server = stage.ActorFor <IServer>(
                () => new ServerActor(resources, filters, port, sizing, timing, channelMailboxTypeName),
                severMailboxTypeName, ServerActor.ServerName, stage.World.AddressFactory.WithHighId(),
                stage.World.DefaultLogger);

            server.StartUp();

            return(server);
        }
Example #6
0
 public static IServer StartWith(Stage stage, Resources resources, Filters filters, int port, Configuration.SizingConf sizing, Configuration.TimingConf timing)
 => StartWith(stage, resources, filters, port, sizing, timing, "queueMailbox", "queueMailbox");
Example #7
0
 public static IServer StartWith(Stage stage, Resources resources, int port, Configuration.SizingConf sizing, Configuration.TimingConf timing)
 => StartWith(stage, resources, Filters.None(), port, sizing, timing);