Пример #1
0
 public RequestSenderProbeActor(Client.Configuration configuration, IResponseChannelConsumer consumer, string testId)
 {
     _channel     = ClientConsumerCommons.ClientChannel(configuration, consumer, Logger);
     _cancellable = Stage.Scheduler.Schedule(
         SelfAs <IScheduled <object?> >(),
         null,
         TimeSpan.FromMilliseconds(1),
         TimeSpan.FromMilliseconds(configuration.ProbeInterval));
     _buffer = new MemoryStream(configuration.WriteBufferSize);
 }
Пример #2
0
        public ServerTest(ITestOutputHelper output) : base(output)
        {
            _output = output;
            UserStateFactory.ResetId();

            _serverPort = BaseServerPort.GetAndIncrement();
            _server     = ServerFactory.StartWith(World.Stage, Resources, _serverPort, new Configuration.SizingConf(1, 1, 100, 10240), new Configuration.TimingConf(10, 1, 1000));
            Assert.True(_server.StartUp().Await(TimeSpan.FromMilliseconds(500L)));

            _progress = new Progress();

            _consumer = World.ActorFor <IResponseChannelConsumer>(() => new TestResponseChannelConsumer(_progress));

            _client = new BasicClientRequestResponseChannel(Address.From(Host.Of("localhost"), _serverPort, AddressType.None), _consumer, 100, 10240, World.DefaultLogger);
        }
Пример #3
0
 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 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 ByteBufferPool(maxBufferPoolSize, maxMessageSize);
     _connectDone = new ManualResetEvent(false);
     _sendDone = new ManualResetEvent(false);
     _receiveDone = new ManualResetEvent(false);
 }
        public static IClientRequestResponseChannel ClientChannel(
            Client.Configuration configuration,
            IResponseChannelConsumer consumer,
            ILogger logger)
        {
            if (configuration.IsSecure)
            {
                return(new SecureClientRequestResponseChannel(
                           configuration.AddressOfHost,
                           consumer,
                           configuration.ReadBufferPoolSize,
                           configuration.ReadBufferSize,
                           logger));
            }

            return(new BasicClientRequestResponseChannel(
                       configuration.AddressOfHost,
                       consumer,
                       configuration.ReadBufferPoolSize,
                       configuration.ReadBufferSize,
                       logger));
        }
Пример #6
0
 protected override IClientRequestResponseChannel GetClient(IResponseChannelConsumer consumer, int maxBufferPoolSize,
                                                            int maxMessageSize, int testPort, ILogger logger) =>
 new BasicClientRequestResponseChannel(Address.From(Host.Of("localhost"), testPort, AddressType.None), consumer, maxBufferPoolSize, maxMessageSize, logger);
Пример #7
0
 protected abstract IClientRequestResponseChannel GetClient(
     IResponseChannelConsumer consumer,
     int maxBufferPoolSize,
     int maxMessageSize,
     int testPort,
     ILogger logger);