Ejemplo n.º 1
0
        internal ClusteredServiceAgent(ClusteredServiceContainer.Context ctx)
        {
            this.ctx = ctx;

            headerVector = new DirectBufferVector(headerBuffer, 0, headerBuffer.Capacity);

            abortHandler      = Abort;
            archiveCtx        = ctx.ArchiveContext();
            aeron             = ctx.Aeron();
            aeronAgentInvoker = ctx.Aeron().ConductorAgentInvoker;
            service           = ctx.ClusteredService();
            idleStrategy      = ctx.IdleStrategy();
            serviceId         = ctx.ServiceId();
            epochClock        = ctx.EpochClock();
            markFile          = ctx.MarkFile();


            var channel = ctx.ServiceControlChannel();

            _consensusModuleProxy =
                new ConsensusModuleProxy(aeron.AddPublication(channel, ctx.ConsensusModuleStreamId()));
            _serviceAdapter = new ServiceAdapter(aeron.AddSubscription(channel, ctx.ServiceStreamId()), this);
            _sessionMessageHeaderEncoder.WrapAndApplyHeader(headerBuffer, 0, new MessageHeaderEncoder());
            aeron.AddCloseHandler(abortHandler);
        }
        internal ClusteredServiceAgent(ClusteredServiceContainer.Context ctx)
        {
            this.ctx = ctx;

            archiveCtx   = ctx.ArchiveContext();
            aeron        = ctx.Aeron();
            service      = ctx.ClusteredService();
            idleStrategy = ctx.IdleStrategy();
            serviceId    = ctx.ServiceId();
            epochClock   = ctx.EpochClock();
            markFile     = ctx.MarkFile();


            var channel = ctx.ServiceControlChannel();

            _consensusModuleProxy = new ConsensusModuleProxy(aeron.AddPublication(channel, ctx.ConsensusModuleStreamId()));
            _serviceAdapter       = new ServiceAdapter(aeron.AddSubscription(channel, ctx.ServiceStreamId()), this);

            UnsafeBuffer headerBuffer = new UnsafeBuffer(new byte[SESSION_HEADER_LENGTH]);

            _egressMessageHeaderEncoder.WrapAndApplyHeader(headerBuffer, 0, new MessageHeaderEncoder());

            _vectors[0] = new DirectBufferVector(headerBuffer, 0, SESSION_HEADER_LENGTH);
            _vectors[1] = _messageVector;
        }
Ejemplo n.º 3
0
        internal ClusteredServiceAgent(ClusteredServiceContainer.Context ctx)
        {
            this.ctx = ctx;

            archiveCtx   = ctx.ArchiveContext();
            aeron        = ctx.Aeron();
            service      = ctx.ClusteredService();
            idleStrategy = ctx.IdleStrategy();
            serviceId    = ctx.ServiceId();
            epochClock   = ctx.EpochClock();
            markFile     = ctx.MarkFile();


            var channel = ctx.ServiceControlChannel();

            _consensusModuleProxy = new ConsensusModuleProxy(aeron.AddPublication(channel, ctx.ConsensusModuleStreamId()));
            _serviceAdapter       = new ServiceAdapter(aeron.AddSubscription(channel, ctx.ServiceStreamId()), this);
        }
Ejemplo n.º 4
0
        internal ClusteredServiceAgent(ClusteredServiceContainer.Context ctx)
        {
            this.ctx = ctx;

            archiveCtx           = ctx.ArchiveContext();
            aeron                = ctx.Aeron();
            shouldCloseResources = ctx.OwnsAeronClient();
            service              = ctx.ClusteredService();
            recordingLog         = ctx.RecordingLog();
            idleStrategy         = ctx.IdleStrategy();
            serviceId            = ctx.ServiceId();
            epochClock           = ctx.EpochClock();
            markFile             = ctx.MarkFile();


            var channel  = ctx.ServiceControlChannel();
            var streamId = ctx.ServiceControlStreamId();

            serviceControlPublisher = new ServiceControlPublisher(aeron.AddPublication(channel, streamId));
            serviceControlAdapter   = new ServiceControlAdapter(aeron.AddSubscription(channel, streamId), this);
        }