private GrainTypeComponents Create(GrainType grainType)
        {
            var result     = new GrainTypeComponents();
            var properties = _resolver.GetGrainProperties(grainType);

            foreach (var configurator in _configurators)
            {
                configurator.Configure(grainType, properties, result);
            }

            return(result);
        }
Exemple #2
0
        public ActivationData(
            ActivationAddress addr,
            PlacementStrategy placedUsing,
            IActivationCollector collector,
            TimeSpan ageLimit,
            IOptions <SiloMessagingOptions> messagingOptions,
            TimeSpan maxWarningRequestProcessingTime,
            TimeSpan maxRequestProcessingTime,
            ILoggerFactory loggerFactory,
            IServiceProvider applicationServices,
            IGrainRuntime grainRuntime,
            GrainReferenceActivator referenceActivator,
            GrainTypeComponents sharedComponents,
            ActivationMessageScheduler messageScheduler)
        {
            if (null == addr)
            {
                throw new ArgumentNullException(nameof(addr));
            }
            if (null == placedUsing)
            {
                throw new ArgumentNullException(nameof(placedUsing));
            }
            if (null == collector)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            _receiveMessageInScheduler = state => this.ReceiveMessageInScheduler(state);
            _shared                              = sharedComponents;
            _messageScheduler                    = messageScheduler;
            logger                               = loggerFactory.CreateLogger <ActivationData>();
            this.lifecycle                       = new GrainLifecycle(loggerFactory.CreateLogger <LifecycleSubject>());
            this.maxRequestProcessingTime        = maxRequestProcessingTime;
            this.maxWarningRequestProcessingTime = maxWarningRequestProcessingTime;
            this.messagingOptions                = messagingOptions.Value;
            ResetKeepAliveRequest();
            Address     = addr;
            State       = ActivationState.Create;
            PlacedUsing = placedUsing;
            if (!this.GrainId.IsSystemTarget())
            {
                this.collector = collector;
            }

            CollectionAgeLimit = ageLimit;

            this.GrainReference = referenceActivator.CreateReference(addr.Grain, default);
            this.serviceScope   = applicationServices.CreateScope();
            this.Runtime        = grainRuntime;
        }