Beispiel #1
0
        internal ClusteredServiceAgent(ClusteredServiceContainer.Context ctx)
        {
            headerVector = new DirectBufferVector(headerBuffer, 0, headerBuffer.Capacity);
            abortHandler = Abort;

            this.ctx = ctx;

            logAdapter = new BoundedLogAdapter(this);

            aeron             = ctx.Aeron();
            aeronAgentInvoker = ctx.Aeron().ConductorAgentInvoker;
            service           = ctx.ClusteredService();
            idleStrategy      = ctx.IdleStrategy();
            serviceId         = ctx.ServiceId();
            epochClock        = ctx.EpochClock();

            var channel = ctx.ControlChannel();

            _consensusModuleProxy =
                new ConsensusModuleProxy(aeron.AddPublication(channel, ctx.ConsensusModuleStreamId()));
            _serviceAdapter = new ServiceAdapter(aeron.AddSubscription(channel, ctx.ServiceStreamId()), this);
            _sessionMessageHeaderEncoder.WrapAndApplyHeader(headerBuffer, 0, new MessageHeaderEncoder());
        }