Exemple #1
0
        public static T GetClaptrap <T>(this IActorProxyFactory factory, IClaptrapIdentity identity)
            where T : IActor
        {
            var re = factory.CreateActorProxy <T>(new ActorId(identity.Id), identity.TypeCode);

            return(re);
        }
Exemple #2
0
 public OrderingProcessEventController(
     IActorProxyFactory actorProxyFactory,
     ILogger <OrderingProcessEventController> logger)
 {
     _actorProxyFactory = actorProxyFactory;
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemple #3
0
 public IdentifiedRemovedLearningAimHandler(IApprenticeshipKeyService apprenticeshipKeyService, IActorProxyFactory proxyFactory, IPaymentLogger logger, IExecutionContext executionContext)
 {
     this.apprenticeshipKeyService = apprenticeshipKeyService;
     this.proxyFactory             = proxyFactory;
     this.logger           = logger;
     this.executionContext = executionContext;
 }
        public MockActorService(
            ICodePackageActivationContext codePackageActivationContext,
            IServiceProxyFactory serviceProxyFactory,
            IActorProxyFactory actorProxyFactory,
            NodeContext nodeContext,
            StatefulServiceContext statefulServiceContext,
            ActorTypeInformation actorTypeInfo,
            Func <ActorService, ActorId, ActorBase> actorFactory = null,
            Func <ActorBase, IActorStateProvider,
                  IActorStateManager> stateManagerFactory = null,
            IActorStateProvider stateProvider             = null,
            ActorServiceSettings settings = null

            ) :
            base(
                context: statefulServiceContext,
                actorTypeInfo: actorTypeInfo,
                actorFactory: actorFactory,
                stateManagerFactory: stateManagerFactory,
                stateProvider: stateProvider,
                settings: settings)
        {
            _codePackageActivationContext = codePackageActivationContext;
            _serviceProxyFactory          = serviceProxyFactory;
            _actorProxyFactory            = actorProxyFactory;
            _nodeContext = nodeContext;
        }
Exemple #5
0
 public UnableToFundTransferFundingSourcePaymentEventHandler(IActorProxyFactory proxyFactory,
                                                             IPaymentLogger logger, IExecutionContext executionContext)
 {
     this.proxyFactory     = proxyFactory ?? throw new ArgumentNullException(nameof(proxyFactory));
     this.logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     this.executionContext = executionContext ?? throw new ArgumentNullException(nameof(executionContext));
 }
Exemple #6
0
 public DaprRpcMinionLocator(
     IActorProxyFactory actorProxyFactory,
     RpcMinionProxy.Factory factory)
 {
     _actorProxyFactory = actorProxyFactory;
     _factory           = factory;
 }
Exemple #7
0
        internal ActorManager(
            ActorRegistration registration,
            ActorActivator activator,
            JsonSerializerOptions jsonSerializerOptions,
            ILoggerFactory loggerFactory,
            IActorProxyFactory proxyFactory,
            IDaprInteractor daprInteractor)
        {
            this.registration          = registration;
            this.activator             = activator;
            this.jsonSerializerOptions = jsonSerializerOptions;
            this.loggerFactory         = loggerFactory;
            this.proxyFactory          = proxyFactory;
            this.daprInteractor        = daprInteractor;

            this.timerManager = new DefaultActorTimerManager(this.daprInteractor);

            // map for remoting calls.
            this.methodDispatcherMap = new ActorMethodDispatcherMap(this.registration.Type.InterfaceTypes);

            // map for non-remoting calls.
            this.actorMethodInfoMap    = new ActorMethodInfoMap(this.registration.Type.InterfaceTypes);
            this.activeActors          = new ConcurrentDictionary <ActorId, ActorActivatorState>();
            this.reminderMethodContext = ActorMethodContext.CreateForReminder(ReceiveReminderMethodName);
            this.timerMethodContext    = ActorMethodContext.CreateForTimer(TimerMethodName);
            this.serializersManager    = IntializeSerializationManager(null);
            this.messageBodyFactory    = new WrappedRequestMessageFactory();

            this.logger = loggerFactory.CreateLogger(this.GetType());
        }
Exemple #8
0
        public static Task RunInContext(this IActorProxyFactory actorProxyFactory, Action <IActorProxyFactory> action, IServiceCommunicationLogger logger, IEnumerable <ServiceRequestHeader> headers)
        {
            Task task         = null;
            var  headersArray = headers.ToArray();

            task = new Task(() =>
            {
                logger?.StartRequestContext(headersArray);
                Debug.Assert(ServiceRequestContext.Current == null);
                ServiceRequestContext.Current        = new ServiceRequestContext(headersArray);
                ServiceRequestContext.Current.Logger = logger;
                try
                {
                    action(actorProxyFactory);
                }
                catch (Exception ex)
                {
                    logger?.FailedRequestContext(headers, ex);
                    throw ex;
                }
                finally
                {
                    ServiceRequestContext.Current = null;
                    logger?.StopRequestContext(headersArray);
                }
            });

            task.Start();

            return(task);
        }
 public EmployerChangedProviderPriorityHandler(IActorProxyFactory proxyFactory,
                                               IPaymentLogger paymentLogger,
                                               IExecutionContext executionContext)
 {
     this.proxyFactory     = proxyFactory ?? new ActorProxyFactory();
     this.paymentLogger    = paymentLogger;
     this.executionContext = (ESFA.DC.Logging.ExecutionContext)executionContext;
 }
Exemple #10
0
        public static T GetClaptrap <T>(this IActorProxyFactory factory, string id)
            where T : IActor
        {
            var attribute = typeof(T).GetCustomAttribute <ClaptrapStateAttribute>() !;
            var re        = factory.CreateActorProxy <T>(new ActorId(id), attribute.ClaptrapTypeCode);

            return(re);
        }
 public TrainController(
     IActorProxyFactory actorProxyFactory,
     ITrainInfoRepository trainInfoRepository,
     IStationRepository stationRepository)
 {
     _actorProxyFactory   = actorProxyFactory;
     _trainInfoRepository = trainInfoRepository;
     _stationRepository   = stationRepository;
 }
 protected SubmissionEventHandler(IActorProxyFactory proxyFactory, ILevyFundingSourceRepository repository,
                                  IPaymentLogger logger, IExecutionContext executionContext, ILevyMessageRoutingService levyMessageRoutingService)
 {
     this.proxyFactory              = proxyFactory ?? throw new ArgumentNullException(nameof(proxyFactory));
     this.repository                = repository ?? throw new ArgumentNullException(nameof(repository));
     this.logger                    = logger ?? throw new ArgumentNullException(nameof(logger));
     this.executionContext          = executionContext ?? throw new ArgumentNullException(nameof(executionContext));
     this.levyMessageRoutingService = levyMessageRoutingService ?? throw new ArgumentNullException(nameof(levyMessageRoutingService));
 }
Exemple #13
0
 public CalculatedRequiredLevyAmountHandler(IActorProxyFactory proxyFactory,
                                            IPaymentLogger paymentLogger,
                                            IExecutionContext executionContext,
                                            ILevyMessageRoutingService levyMessageRoutingService)
 {
     this.proxyFactory              = proxyFactory ?? new ActorProxyFactory();
     this.paymentLogger             = paymentLogger;
     this.levyMessageRoutingService = levyMessageRoutingService ?? throw new ArgumentNullException(nameof(levyMessageRoutingService));
     this.executionContext          = (ESFA.DC.Logging.ExecutionContext)executionContext;
 }
Exemple #14
0
        public WebScraperService(StatelessServiceContext context)
            : base(context)
        {
            _actorProxyFactory   = new ActorProxyFactory();
            _serviceProxyFactory = new ServiceProxyFactory();            //retrySettings: new OperationRetrySettings(TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(3), 1));

            _speakerActorApplicationName = FabricRuntime.GetActivationContext().ApplicationName;
            _speakerActorServiceName     = $"{typeof(ISpeakerActor).Name.Substring(1)}Service";
            _speakerActorServiceUri      = new Uri($"{_speakerActorApplicationName}/{_speakerActorServiceName}");
        }
Exemple #15
0
 protected EarningEventHandlerBase(IApprenticeshipKeyService apprenticeshipKeyService,
                                   IActorProxyFactory proxyFactory,
                                   IPaymentLogger paymentLogger,
                                   IExecutionContext executionContext)
 {
     this.apprenticeshipKeyService = apprenticeshipKeyService;
     this.proxyFactory             = proxyFactory ?? new ActorProxyFactory();
     this.paymentLogger            = paymentLogger;
     this.executionContext         = (ESFA.DC.Logging.ExecutionContext)executionContext;
 }
        public HomeController()
        {
            _actorProxyFactory   = new ActorProxyFactory();
            _serviceProxyFactory = new ServiceProxyFactory();            //retrySettings: new OperationRetrySettings(TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(3), 1));

            _speakerActorApplicationName = FabricRuntime.GetActivationContext().ApplicationName;
            _speakerActorServiceName     = $"{typeof(ISpeakerActor).Name.Substring(1)}Service";
            _speakerActorServiceUri      = new Uri($"{_speakerActorApplicationName}/{_speakerActorServiceName}");

            GetSpeakerActorPartitionList();
        }
 public static IKernel WithCore(this IKernel kernel,
                                ServiceContext serviceContext,
                                IActorStateManager stateManager,
                                IClusterClient clusterClient             = null,
                                TelemetryClient telemetry                = null,
                                IActorProxyFactory actorProxyFactory     = null,
                                IServiceProxyFactory serviceProxyFactory = null)
 {
     kernel.Load(new CoreModule(serviceContext, stateManager, clusterClient, telemetry, actorProxyFactory, serviceProxyFactory));
     return(kernel);
 }
 public SubscriptionActor(
     BuildAssetRegistryContext context,
     ILogger <SubscriptionActor> logger,
     IActionRunner actionRunner,
     IActorProxyFactory <IPullRequestActor> pullRequestActorFactory)
 {
     Context                 = context;
     Logger                  = logger;
     ActionRunner            = actionRunner;
     PullRequestActorFactory = pullRequestActorFactory;
 }
 public DaprMinionActivator(
     ILogger <DaprMinionActivator> logger,
     IActorProxyFactory actorProxyFactory,
     IClaptrapDesignStore claptrapDesignStore)
 {
     _logger            = logger;
     _actorProxyFactory = actorProxyFactory;
     _minionLookUp      = claptrapDesignStore.Where(x => x.ClaptrapMasterDesign != null)
                          .ToLookup(x => x.ClaptrapMasterDesign !.ClaptrapTypeCode)
                          .ToDictionary(x => x.Key, x => x.ToArray());
 }
 public UpdateOrderStatusEventController(
     IOrderRepository orderRepository,
     IHubContext <NotificationsHub> hubContext,
     IActorProxyFactory actorProxyFactory,
     ILogger <UpdateOrderStatusEventController> logger)
 {
     _orderRepository   = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
     _hubContext        = hubContext ?? throw new ArgumentNullException(nameof(hubContext));
     _actorProxyFactory = actorProxyFactory ?? throw new ArgumentNullException(nameof(actorProxyFactory));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemple #21
0
 public ExampleClient(StatefulServiceContext serviceContext, IReliableStateManagerReplica2 reliableStateManagerReplica,
                      IActorEventSubscriptionHelper subscriptionHelper, IActorProxyFactory actorProxyFactory)
     : base(serviceContext, reliableStateManagerReplica)
 {
     if (actorProxyFactory == null)
     {
         throw new ArgumentNullException(nameof(actorProxyFactory));
     }
     _subscriptionHelper = subscriptionHelper ?? new ActorEventSubscriptionHelper();
     _actorProxyFactory  = actorProxyFactory;
 }
Exemple #22
0
 public ClaptrapHandler(IActorProxyFactory actorProxyFactory,
                        IClaptrapDesignStore claptrapDesignStore,
                        IEventSerializer <EventJsonModel> eventSerializer,
                        IEventStringSerializer eventStringSerializer)
 {
     _actorProxyFactory     = actorProxyFactory;
     _eventSerializer       = eventSerializer;
     _eventStringSerializer = eventStringSerializer;
     _minionTypeCodes       = claptrapDesignStore.Where(x => x.IsMinion())
                              .GroupBy(x => x.ClaptrapMasterDesign !.ClaptrapTypeCode)
                              .ToDictionary(x => x.Key, x => x.Select(a => a.ClaptrapTypeCode));
 }
 /// <summary>
 /// Default ctor used at runtime
 /// </summary>
 /// <param name="context"></param>
 /// <param name="bigBrother"></param>
 /// <param name="serviceBusManager"></param>
 /// <param name="proxyFactory"></param>
 /// <param name="settings"></param>
 public EventReaderService(
     StatefulServiceContext context,
     IBigBrother bigBrother,
     IServiceBusManager serviceBusManager,
     IActorProxyFactory proxyFactory,
     ConfigurationSettings settings)
     : base(context)
 {
     _bigBrother        = bigBrother;
     _serviceBusManager = serviceBusManager;
     _proxyFactory      = proxyFactory;
     _settings          = settings;
     ParseOutInitData(context.InitializationData);
 }