Ejemplo n.º 1
0
        //---------------------------------------------------------------------
        public async Task Start(IPAddress ip_address, int port,
            string orleansClientConfigFile, GatewaySessionFactory factory)
        {
            bootstrap
                    .Group(bossGroup, workerGroup)
                    .Channel<TcpServerSocketChannel>()
                    .Option(ChannelOption.SoBacklog, 100)
                    .Handler(new LoggingHandler(LogLevel.INFO))
                    .ChildHandler(new ActionChannelInitializer<ISocketChannel>(channel =>
                    {
                        IChannelPipeline pipeline = channel.Pipeline;
                        pipeline.AddLast(new LengthFieldPrepender(
                            ByteOrder.LittleEndian, 2, 0, false));
                        pipeline.AddLast(new LengthFieldBasedFrameDecoder(
                            ByteOrder.LittleEndian, ushort.MaxValue, 0, 2, 0, 2, true));
                        pipeline.AddLast(new GatewayChannelHandler(factory));
                    }));

            bootstrapChannel = await bootstrap.BindAsync(ip_address, port);

            GrainClient.Initialize(orleansClientConfigFile);
        }
Ejemplo n.º 2
0
 //---------------------------------------------------------------------
 public GatewayChannelHandler(GatewaySessionFactory factory)
 {
     this.factory = factory;
 }