public static EventStoreStatelessActorBuilder <TActor, TRegistry> Create( ClusterVNode clusterVNode, ConnectionSettings connectionSettings, IActorConfiguration actorConfiguration, ILoggerFactory?loggerFactory = null, Action <IEventStoreRepositoryConfiguration>?getEventStoreRepositoryConfiguration = null) { var connection = EmbeddedEventStoreConnection.Create(clusterVNode, connectionSettings); loggerFactory ??= new DummyLoggerFactory(); var eventStoreRepositoryConfiguration = new EventStoreRepositoryConfiguration(); getEventStoreRepositoryConfiguration?.Invoke(eventStoreRepositoryConfiguration); var connectionStatusMonitor = new EventStoreConnectionStatusMonitor(connection, loggerFactory); var eventStoreRepository = new EventStoreRepository( eventStoreRepositoryConfiguration, connection, connectionStatusMonitor, loggerFactory); var eventStoreStatelessActorBuilder = new EventStoreStatelessActorBuilder <TActor, TRegistry>(actorConfiguration, eventStoreRepository, connectionStatusMonitor, loggerFactory); return(eventStoreStatelessActorBuilder); }
public EventStoreStatefulActorBuilder(World world, IActorConfiguration actorConfiguration, IEventStoreActorConfigurationFactory eventStoreCacheFactory) { _streamsToRegisterTo = new List <Func <IConnectionStatusMonitor <IEventStoreConnection>, ILoggerFactory, IEventStoreStream> >(); _eventStoreCacheFactory = eventStoreCacheFactory; _actorConfiguration = actorConfiguration; _busToRegisterTo = new Dictionary <Type, Action <IServiceProvider, IActor> >(); _world = world; }
/// <summary> /// Creates an actor with a key in the constructor /// </summary> /// <param name="dependencyResolver"></param> /// <param name="configuration"></param> /// <param name="key"></param> /// <param name="keyType"></param> /// <returns></returns> public static IActor CreateWithKeyDependency(IContainer dependencyResolver, IActorConfiguration configuration, object key, Type keyType) { // Strange behavior from JSON.NET - apparently if you serialize an integer but with object metadata, it gets de-serialized // as a 64-bit integer! So we need to change it manually back to the declared type var realKey = Convert.ChangeType(key, keyType); return(((IActor)dependencyResolver.Resolve(configuration.ActorType, new TypedParameter(keyType, realKey))).Configure(configuration)); }
public Orchestrator(IActorConfiguration configuration, IEventQueueOperator queueOperator, IServiceLocator serviceLocator) { _queueOperator = queueOperator; _serviceLocator = serviceLocator; _configuration = configuration; }
public static IActorManager ToActorManager(this IActorConfiguration self) { if (self == null) { return(null); } return(new ActorManager(self)); }
public static EventStoreStatelessActorBuilder <TActor, TRegistry> Create(string eventStoreConnectionString, ConnectionSettingsBuilder connectionSettingsBuilder, IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null, Action <IEventStoreRepositoryConfiguration> getEventStoreRepositoryConfiguration = null) { var connection = EventStoreConnection.Create(eventStoreConnectionString, connectionSettingsBuilder); return(CreateInternal(actorConfiguration, connection, loggerFactory, getEventStoreRepositoryConfiguration)); }
public static void ActorRegistered(this IActorConfiguration configuration, IWorkContext context, Type interfaceType, string message = null) { Verify.IsNotNull(nameof(configuration), configuration); Verify.IsNotNull(nameof(interfaceType), interfaceType); IEventDimensions dimensions = new EventDimensionsBuilder() .Add(nameof(interfaceType), interfaceType) .Add(nameof(message), message) .Build(); configuration.WorkContext.EventLog.LogEvent(context, TelemetryLevel.Verbose, _actorEventName, nameof(ActorRegistered), dimensions); }
public static void ActorTimerCallback(this IActorConfiguration configuration, IWorkContext context, ActorKey actorKey, string message = null) { Verify.IsNotNull(nameof(configuration), configuration); Verify.IsNotNull(nameof(actorKey), actorKey); IEventDimensions dimensions = new EventDimensionsBuilder() .Add(nameof(actorKey), actorKey) .Add(nameof(message), message) .Build(); configuration.WorkContext.EventLog.LogEvent(context, TelemetryLevel.Verbose, _actorEventName, nameof(ActorTimerCallback), dimensions); }
public ActorManager(IActorConfiguration configuration) { Verify.IsNotNull(nameof(configuration), configuration); Configuration = configuration; _actorRepository = Configuration.ActorRepository ?? new ActorRepository(Configuration); foreach (ActorTypeRegistration registration in configuration?.Registration ?? Enumerable.Empty <ActorTypeRegistration>()) { _typeManager.Register(_actorManagerWorkContext, registration); } }
public ActorConfigurationBuilder(IActorConfiguration configuration) { Verify.IsNotNull(nameof(configuration), configuration); Capacity = configuration.Capacity; ActorRepository = configuration.ActorRepository; ActorCallTimeout = configuration.ActorCallTimeout; ActorRetirementPeriod = configuration.ActorRetirementPeriod; InactivityScanPeriod = configuration.InactivityScanPeriod; Registration = configuration.Registration; WorkContext = configuration.WorkContext; }
public EventStoreStatefulActorBuilder(IActorConfiguration actorConfiguration, IEventStoreAggregateRepository eventStoreRepository, IConnectionStatusMonitor <IEventStoreConnection> connectionMonitor, ILoggerFactory loggerFactory ) { ActorConfiguration = actorConfiguration; EventStoreRepository = eventStoreRepository; LoggerFactory = loggerFactory; ConnectionMonitor = connectionMonitor; _busToRegisterTo = new Dictionary <Type, Action <Container, IActor> >(); }
public static StatelessActorBuilder <TActor, TRegistry> Create( IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) { loggerFactory ??= new DummyLoggerFactory(); var builder = new StatelessActorBuilder <TActor, TRegistry> { LoggerFactory = loggerFactory, ActorConfiguration = actorConfiguration }; return(builder); }
public ActorRepository(IActorConfiguration configuration) { Verify.IsNotNull(nameof(configuration), configuration); Verify.Assert(configuration.Capacity > 0, $"Capacity {configuration.Capacity} must be greater than 0"); _workContext = new WorkContextBuilder(configuration.WorkContext) .Set(_tag) .Set(new CorrelationVector("Khooversoft-ActorRepository")) .Build(); _configuration = configuration; _actors = new LruCache <RegistrationKey, IActorRegistration>(_configuration.Capacity, new RegistrationKeyComparer()); _actors.CacheItemRemoved += x => _actorRemovedQueue.Enqueue(x.Value); _timer = new Timer(GarbageCollection, null, _configuration.InactivityScanPeriod, _configuration.InactivityScanPeriod); }
/// <summary> /// Updates the DegreeOfParallelism with entry from configuration in the form of Beehive.ActorParallelism.{ActorName} /// </summary> /// <param name="configuration"></param> /// <param name="configurationValueProvider"></param> /// <returns>an updated configuration</returns> public static IActorConfiguration UpdateParallelism(this IActorConfiguration configuration, IConfigurationValueProvider configurationValueProvider) { var descriptors = configuration.GetDescriptors() .Select(descriptor => { string value = configurationValueProvider.GetValue("Beehive.ActorParallelism." + descriptor.ActorType.Name); int parallelism = descriptor.DegreeOfParallelism; if (int.TryParse(value, out parallelism)) { descriptor.DegreeOfParallelism = parallelism; } return(descriptor); }); return(new NoNonsenseConfiguration(descriptors)); }
private static EventStoreStatelessActorBuilder <TActor, TRegistry> CreateInternal( IActorConfiguration actorConfiguration, IEventStoreConnection eventStoreConnection, ILoggerFactory loggerFactory = null, Action <IEventStoreRepositoryConfiguration> eventStoreRepositoryConfigurationBuilder = null) { loggerFactory ??= new DummyLoggerFactory(); var eventStoreRepositoryConfiguration = new EventStoreRepositoryConfiguration(); eventStoreRepositoryConfigurationBuilder?.Invoke(eventStoreRepositoryConfiguration); var connectionMonitor = new EventStoreConnectionStatusMonitor(eventStoreConnection, loggerFactory); var eventStoreRepository = new EventStoreAggregateRepository( eventStoreRepositoryConfiguration, eventStoreConnection, connectionMonitor, loggerFactory); var builder = new EventStoreStatelessActorBuilder <TActor, TRegistry>(actorConfiguration, eventStoreRepository, connectionMonitor, loggerFactory); return(builder); }
public TestCatchupWithMailboxActor(IActorConfiguration actorConfiguration, IAggregateCache <SomeDataAggregate> eventStoreCache, ILoggerFactory loggerFactory = null) : base(actorConfiguration, eventStoreCache, loggerFactory) { }
public TestStatefulActorOneHealthChecksMvc(IActorConfiguration actorConfiguration, IAggregateCache <SomeDataAggregate> eventStoreCache, ILoggerFactory loggerFactory = null) : base(actorConfiguration, eventStoreCache, loggerFactory) { }
public TestStatelessActorOneHealthChecksMvc(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
public TestSingleQueueMqActor(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
public TestBuilderActor(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
public EventCountStatelessActor(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
public TradeSink(IActorConfiguration actorConfiguration, IAggregateCache <Trade> eventStoreCache, ILoggerFactory loggerFactory = null) : base(actorConfiguration, eventStoreCache, loggerFactory) { }
public TestStatelessActor(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { ProcessedEvents = new List <IEvent>(); }
public TestActorReceiver(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
/// <summary> /// Creates an actor according to the actor configuration's specified type and configures it /// </summary> /// <param name="dependencyResolver"></param> /// <param name="configuration"></param> /// <returns></returns> public static IActor Create(IContainer dependencyResolver, IActorConfiguration configuration) { return(((IActor)dependencyResolver.Resolve(configuration.ActorType)).Configure(configuration)); }
public TestActorAutoBuildTwo(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
public void AddConfiguration <TActor>(IActorConfiguration actorConfiguration) { _actorConfigurations.Add(typeof(TActor), actorConfiguration); }
public EventCountStatefulActor(IActorConfiguration actorConfiguration, IAggregateCache <EventCountAggregate> eventStoreCache, ILoggerFactory loggerFactory = null) : base(actorConfiguration, eventStoreCache, loggerFactory) { }
public TestMarketDataChangedActor(IActorConfiguration actorConfiguration, ILoggerFactory loggerFactory = null) : base(actorConfiguration, loggerFactory) { }
public TestErrorHandlingStatefulActor(IActorConfiguration actorConfiguration, IAggregateCache <SomeDataAggregate> eventStoreCache, ILoggerFactory loggerFactory = null) : base(actorConfiguration, eventStoreCache, loggerFactory) { }