public SimpleMessageDispatcher(IMessageListener messageListener, ITransportMessageCodecFactory transportMessageCodecFactory, ILogger logger)
 {
     _messageListener = messageListener;
     _logger = logger;
     _transportMessageEncoder = transportMessageCodecFactory.GetEncoder();
     _transportMessageDecoder = transportMessageCodecFactory.GetDecoder();
 }
 /// <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();
 }
 public DefaultDotNettyServerMessageListener(ITransportMessageCodecFactory codecFactory,
                                             ILogger <DefaultDotNettyServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
 }
        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));
            }));
        }
Esempio n. 5
0
 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;
 }
 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. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotNettyHttpServerMessageListener" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="codecFactory">The codec factory.</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="serviceRouteProvider">The service route provider.</param>
 public DotNettyHttpServerMessageListener(ILogger <DotNettyHttpServerMessageListener> logger,
                                          ITransportMessageCodecFactory codecFactory,
                                          ISerializer <string> serializer,
                                          IServiceRouteProvider serviceRouteProvider)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _serializer           = serializer;
     _serviceRouteProvider = serviceRouteProvider;
 }
Esempio n. 11
0
 public DotNettyClientFactory(ITransportMessageCodecFactory factory, ILogger <DotNettyClientFactory> logger)
 {
     _decoder   = factory.CreateDecoder();
     _logger    = logger;
     _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 ChannelDecoderHandlerAdpter(_decoder, _logger));
         pipeline.AddLast(new ChannelClientHandlerAdpter(origEndPointKey, _clientServiceAttributeKey, _logger, /* GetOrAdd,*/ RemoveClient));
     }));
 }
Esempio n. 12
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));
     }));
 }
Esempio n. 13
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));
     }));
 }
 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. 15
0
 public DotNettyTransportClientFactory(ITransportMessageCodecFactory codecFactory, ILogger <DotNettyTransportClientFactory> logger)
     : this(codecFactory, logger, null)
 {
 }
Esempio n. 16
0
 public DotNettyServerMessageListener(ILogger<DotNettyServerMessageListener> logger, ITransportMessageCodecFactory codecFactory)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
 }
Esempio n. 17
0
 public SimpleTransportClientFactory(ITransportMessageCodecFactory transportMessageCodecFactory, ILogger<SimpleTransportClientFactory> logger, IServiceExecutor serviceExecutor)
 {
     _transportMessageCodecFactory = transportMessageCodecFactory;
     _logger = logger;
     _serviceExecutor = serviceExecutor;
 }
Esempio n. 18
0
        /// <summary>
        /// 使用编解码器。
        /// </summary>
        /// <param name="builder">Rpc服务构建者。</param>
        /// <param name="codecFactory"></param>
        /// <returns>Rpc服务构建者。</returns>
        public static IRpcBuilder UseCodec(this IRpcBuilder builder, ITransportMessageCodecFactory codecFactory)
        {
            builder.Services.AddSingleton(codecFactory);

            return(builder);
        }
 public DotNettyTransportClientFactory(ITransportMessageCodecFactory codecFactory, IHealthCheckService healthCheckService, ILogger <DotNettyTransportClientFactory> logger)
     : this(codecFactory, healthCheckService, logger, null)
 {
 }
Esempio n. 20
0
 public SimpleServerMessageListener(ITransportMessageCodecFactory codecFactory, ILogger <SimpleServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
 }
Esempio n. 21
0
 public ThriftServerMessageListener(ILogger <ThriftServerMessageListener> logger, IThriftServiceEntryProvider thriftServiceEntryProvider, ITransportMessageCodecFactory codecFactory)
 {
     _logger = logger;
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _entries = thriftServiceEntryProvider.GetEntries().ToList();
 }
Esempio n. 22
0
 public SimpleTransportClientFactory(ITransportMessageCodecFactory transportMessageCodecFactory, ILogger <SimpleTransportClientFactory> logger, IServiceExecutor serviceExecutor)
 {
     _transportMessageCodecFactory = transportMessageCodecFactory;
     _logger          = logger;
     _serviceExecutor = serviceExecutor;
 }
Esempio n. 23
0
 public SimpleTransportClientFactory(ITransportMessageCodecFactory transportMessageCodecFactory, ILogger <SimpleTransportClientFactory> logger) : this(transportMessageCodecFactory, logger, null)
 {
 }
Esempio n. 24
0
 public DotNettySocketService(IServiceInvoker invoker, ITransportMessageCodecFactory codecFactory, ILogger <DotNettySocketService> logger)
 {
     _encoder = codecFactory.CreateEncoder();
     _invoker = invoker;
     _logger  = logger;
 }
 public DotNettyServerBootstrap(IOptions <ServerAddress> address, ISocketService service, ITransportMessageCodecFactory codecFactory, ILogger <DotNettyServerBootstrap> logger)
 {
     _logger  = logger;
     _address = address;
     _decoder = codecFactory.CreateDecoder();
     _service = service;
 }
 public SimpleServerMessageListener(ITransportMessageCodecFactory codecFactory, ILogger<SimpleServerMessageListener> logger)
 {
     _transportMessageEncoder = codecFactory.GetEncoder();
     _transportMessageDecoder = codecFactory.GetDecoder();
     _logger = logger;
 }
 /// <summary>
 /// 使用编解码器。
 /// </summary>
 /// <param name="builder">服务构建者。</param>
 /// <param name="codecFactory"></param>
 /// <returns>服务构建者。</returns>
 public static IServiceBuilder UseCodec(this IServiceBuilder builder, ITransportMessageCodecFactory codecFactory)
 {
     builder.Services.RegisterInstance(codecFactory).SingleInstance();
     return(builder);
 }
Esempio n. 28
0
 public SimpleTransportClientFactory(ITransportMessageCodecFactory transportMessageCodecFactory, ILogger<SimpleTransportClientFactory> logger)
     : this(transportMessageCodecFactory, logger, null)
 {
 }