Esempio n. 1
0
 public TMultiplexedServiceProcessor(ILogger logger, ITransportMessageDecoder transportMessageDecoder, ITransportMessageEncoder transportMessageEncoder, ServerHandler serverHandler)
 {
     _logger = logger;
     _transportMessageDecoder = transportMessageDecoder;
     _transportMessageEncoder = transportMessageEncoder;
     _serverHandler           = serverHandler;
 }
Esempio n. 2
0
 public ThriftServerMessageListener(ILogger <ThriftServerMessageListener> logger, IThriftServiceEntryProvider thriftServiceEntryProvider, ITransportMessageCodecFactory codecFactory)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _entries = thriftServiceEntryProvider.GetEntries().ToList();
 }
 public DotNettyHttpServerMessageListener(ILogger <DotNettyHttpServerMessageListener> logger, ITransportMessageCodecFactory codecFactory, ISerializer <string> serializer)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _serializer = serializer;
 }
Esempio n. 4
0
        public void TestCodec()
        {
            Person person = new Person
            {
                Name = "张宏伟",
                Age  = 18
            };
            TransportMessage transportMessage = new TransportMessage
            {
                Id          = "1",
                ContentType = "Person",
                Content     = person
            };
            MessagePackTransportMessageCodecFactory factory = new MessagePackTransportMessageCodecFactory();
            ITransportMessageEncoder encoder = factory.GetEncoder();
            ITransportMessageDecoder decoder = factory.GetDecoder();

            byte[]           vs      = encoder.Encode(transportMessage);
            TransportMessage message = decoder.Decode(vs);

            Assert.AreEqual(message.Id, "1");
            Assert.AreEqual(message.ContentType, "Person");
            Assert.AreEqual(((object[])message.Content)[0].ToString(), "张宏伟");
            Assert.AreEqual(((object[])message.Content)[1].ToString(), "18");
        }
        public DotNettyTransportClientFactory(ITransportMessageCodecFactory codecFactory,
                                              IHealthCheckService healthCheckService, ILogger <DotNettyTransportClientFactory> logger,
                                              IServiceExecutor serviceExecutor)
        {
            _transportMessageEncoder = codecFactory.GetEncoder();
            _transportMessageDecoder = codecFactory.GetDecoder();
            _logger             = logger;
            _healthCheckService = healthCheckService;
            _serviceExecutor    = serviceExecutor;
            _bootstrap          = GetBootstrap();
            _bootstrap.Handler(new ActionChannelInitializer <ISocketChannel>(c =>
            {
                var pipeline = c.Pipeline;
                pipeline.AddLast(new LengthFieldPrepender(4));
                pipeline.AddLast(new LengthFieldBasedFrameDecoder(int.MaxValue, 0, 4, 0, 4));
                if (AppConfig.ServerOptions.EnableHealthCheck)
                {
                    pipeline.AddLast(new IdleStateHandler(0, AppConfig.ServerOptions.HealthCheckWatchIntervalInSeconds, 0));
                    pipeline.AddLast(DotNettyConstants.HeartBeatName, new HeartBeatHandler(_healthCheckService, this));
                }

                pipeline.AddLast(DotNettyConstants.TransportMessageAdapterName,
                                 new TransportMessageChannelHandlerAdapter(_transportMessageDecoder));
                pipeline.AddLast(DotNettyConstants.ClientChannelHandler,
                                 new DefaultChannelHandler(this, healthCheckService));
            }));
        }
 public SimpleMessageDispatcher(IMessageListener messageListener, ITransportMessageCodecFactory transportMessageCodecFactory, ILogger logger)
 {
     _messageListener = messageListener;
     _logger = logger;
     _transportMessageEncoder = transportMessageCodecFactory.GetEncoder();
     _transportMessageDecoder = transportMessageCodecFactory.GetDecoder();
 }
 public ThriftTransportClientFactory(ITransportMessageCodecFactory codecFactory, CommandLineApplication app, IConsole console)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _app     = app;
     _console = console;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DotNettyUdpServerMessageListener" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="codecFactory">The codec factory.</param>
 public DotNettyUdpServerMessageListener(ILogger <DotNettyUdpServerMessageListener> logger
                                         , ITransportMessageCodecFactory codecFactory)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
 }
Esempio n. 9
0
 public SimpleMessageDispatcher(IMessageListener messageListener, ITransportMessageCodecFactory transportMessageCodecFactory, ILogger logger)
 {
     _messageListener         = messageListener;
     _logger                  = logger;
     _transportMessageEncoder = transportMessageCodecFactory.GetEncoder();
     _transportMessageDecoder = transportMessageCodecFactory.GetDecoder();
 }
 public DefaultDotNettyServerMessageListener(ITransportMessageCodecFactory codecFactory,
                                             ILogger <DefaultDotNettyServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
 }
 public ThriftTransportClientFactory(ITransportMessageCodecFactory codecFactory, IHealthCheckService healthCheckService, ILogger <ThriftTransportClientFactory> logger, IServiceExecutor serviceExecutor)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger             = logger;
     _healthCheckService = healthCheckService;
     _serviceExecutor    = serviceExecutor;
 }
 public DotNettyTransportClientFactory(ITransportMessageCodecFactory codecFactory, ILogger <DotNettyTransportClientFactory> logger, IServiceExecutor serviceExecutor)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger          = logger;
     _serviceExecutor = serviceExecutor;
     _bootstrap       = GetBootstrap();
 }
 public DefaultDotNettyServerMessageListener(ITransportMessageCodecFactory codecFactory,
                                             ILogger <DefaultDotNettyServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
     Console.Write("create transport message for encoder and decoder.");
 }
Esempio n. 14
0
 public NettyTransportClientFactory(ITransportMessageCodecFactory codecFactory, CommandLineApplication app, IConsole console)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _app       = app;
     _console   = console;
     _bootstrap = GetBootstrap();
     _bootstrap.Handler(new ActionChannelInitializer <ISocketChannel>(c =>
     {
         var pipeline = c.Pipeline;
         pipeline.AddLast(new LengthFieldPrepender(4));
         pipeline.AddLast(new LengthFieldBasedFrameDecoder(int.MaxValue, 0, 4, 0, 4));
         pipeline.AddLast(new TransportMessageChannelHandlerAdapter(_transportMessageDecoder));
         pipeline.AddLast(new DefaultChannelHandler(this));
     }));
 }
Esempio n. 15
0
 public DotNettyTransportClientFactory(ITransportMessageCodecFactory codecFactory, ILogger <DotNettyTransportClientFactory> logger, IServiceExecutor serviceExecutor)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger          = logger;
     _serviceExecutor = serviceExecutor;
     _bootstrap       = GetBootstrap();
     _bootstrap.Handler(new ActionChannelInitializer <ISocketChannel>(c =>
     {
         var pipeline = c.Pipeline;
         pipeline.AddLast(new LengthFieldPrepender(4));
         pipeline.AddLast(new LengthFieldBasedFrameDecoder(int.MaxValue, 0, 4, 0, 4));
         pipeline.AddLast(new TransportMessageChannelHandlerAdapter(_transportMessageDecoder));
         pipeline.AddLast(new DefaultChannelHandler(this));
     }));
 }
 public DotNettyTransportClientFactory(ITransportMessageCodecFactory codecFactory, ILogger <DotNettyTransportClientFactory> logger, IServiceExecutor serviceExecutor)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger          = logger;
     _serviceExecutor = serviceExecutor;
     //_bootstrap = GetBootstrap();
     //_bootstrap.Handler(new ActionChannelInitializer<ISocketChannel>(c =>
     //{
     //    var pipeline = c.Pipeline;
     //    pipeline.AddLast(
     //        new IdleStateHandler(0, 4, 0),
     //        this.idleStateTrigger,
     //        new ProtocolDecoder(),
     //        encoder,
     //        new TransportMessageChannelHandlerAdapter(_transportMessageDecoder),
     //        new DefaultChannelHandler(this));
     //}));
 }
Esempio n. 17
0
 public SimpleClientMessageSender(ITransportMessageEncoder transportMessageEncoder, TcpSocketSaeaClient client) : base(transportMessageEncoder)
 {
     _client = client;
 }
Esempio n. 18
0
 public SimpleClientMessageSender(ITransportMessageEncoder transportMessageEncoder, Func <TcpSocketSaeaClient> clientFactory) : base(transportMessageEncoder)
 {
     _clientFactory = clientFactory;
 }
Esempio n. 19
0
 protected SimpleMessageSender(ITransportMessageEncoder transportMessageEncoder)
 {
     _transportMessageEncoder = transportMessageEncoder;
 }
Esempio n. 20
0
 public SimpleServerMessageSender(ITransportMessageEncoder transportMessageEncoder, TcpSocketSaeaSession session, ILogger logger) : base(transportMessageEncoder)
 {
     _session = session;
     _logger = logger;
 }
Esempio n. 21
0
 public DefaultTransportMessageCodecFactory()
 {
     _encoder = new JsonTransportMessageEncoder();
     _decoder = new JsonTransportMessageDecoder();
 }
 public DotNettyHttpServerMessageSender(ITransportMessageEncoder transportMessageEncoder, IChannelHandlerContext context, ISerializer <string> serializer) : base(transportMessageEncoder)
 {
     _context    = context;
     _serializer = serializer;
 }
 public DefaultDotNettyMessageClientSender(ITransportMessageEncoder transportMessageEncoder, IChannel channel) :
     base(transportMessageEncoder)
 {
     _channel = channel;
 }
Esempio n. 24
0
 public SimpleServerMessageListener(ITransportMessageCodecFactory codecFactory, ILogger <SimpleServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
 }
Esempio n. 25
0
 public SimpleClientMessageSender(ITransportMessageEncoder transportMessageEncoder, TcpSocketSaeaClient client) : base(transportMessageEncoder)
 {
     _client = client;
 }
Esempio n. 26
0
 protected ThriftMessageSender(ITransportMessageEncoder transportMessageEncoder)
 {
     _transportMessageEncoder = transportMessageEncoder;
 }
Esempio n. 27
0
 public DotNettyDnsServerMessageSender(ITransportMessageEncoder transportMessageEncoder, IChannelHandlerContext context) : base(transportMessageEncoder)
 {
     _context = context;
 }
Esempio n. 28
0
 public DotNettyMessageClientSender(ITransportMessageEncoder transportMessageEncoder, Task <IChannel> channel) : base(transportMessageEncoder)
 {
     _channel = channel;
 }
Esempio n. 29
0
 public SimpleServerMessageSender(ITransportMessageEncoder transportMessageEncoder, TcpSocketSaeaSession session, ILogger logger) : base(transportMessageEncoder)
 {
     _session = session;
     _logger  = logger;
 }
Esempio n. 30
0
 public DotNettyServerMessageListener(ILogger<DotNettyServerMessageListener> logger, ITransportMessageCodecFactory codecFactory)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
 }
 public SimpleServerMessageListener(ITransportMessageCodecFactory codecFactory, ILogger<SimpleServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
 }
Esempio n. 32
0
 protected DotNettyMessageSender(ITransportMessageEncoder transportMessageEncoder)
 {
     _transportMessageEncoder = transportMessageEncoder;
 }
Esempio n. 33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotNettyUdpMessageSender" /> class.
 /// </summary>
 /// <param name="transportMessageEncoder">The transport message encoder.</param>
 protected DotNettyUdpMessageSender(ITransportMessageEncoder transportMessageEncoder)
 {
     _transportMessageEncoder = transportMessageEncoder;
 }
Esempio n. 34
0
 public DotNettySocketService(IServiceInvoker invoker, ITransportMessageCodecFactory codecFactory, ILogger <DotNettySocketService> logger)
 {
     _encoder = codecFactory.CreateEncoder();
     _invoker = invoker;
     _logger  = logger;
 }
Esempio n. 35
0
 public DotNettyMessageClientSender(ITransportMessageEncoder transportMessageEncoder, Task<IChannel> channel) : base(transportMessageEncoder)
 {
     _channel = channel;
 }
Esempio n. 36
0
 public ThriftServerMessageSender(ITransportMessageEncoder transportMessageEncoder, TProtocol context) : base(transportMessageEncoder)
 {
     _protocol = context;
 }
Esempio n. 37
0
 public DotNettyServerMessageSender(ITransportMessageEncoder transportMessageEncoder, IChannelHandlerContext context) : base(transportMessageEncoder)
 {
     _context = context;
 }
Esempio n. 38
0
 protected DefaultDotNettyMessageSender(ITransportMessageEncoder transportMessageEncoder)
 {
     _transportMessageEncoder = transportMessageEncoder;
 }
Esempio n. 39
0
 protected SimpleMessageSender(ITransportMessageEncoder transportMessageEncoder)
 {
     _transportMessageEncoder = transportMessageEncoder;
 }