public InMemoryStateStoreActor(IEnumerable <IDispatcher> dispatchers, long checkConfirmationExpirationInterval, long confirmationExpiration) { if (dispatchers == null) { throw new ArgumentNullException(nameof(dispatchers), "Dispatcher must not be null."); } _dispatchers = dispatchers.ToList(); _entryAdapterProvider = EntryAdapterProvider.Instance(Stage.World); _stateAdapterProvider = StateAdapterProvider.Instance(Stage.World); _entries = new List <IEntry>(); _entryReaders = new Dictionary <string, IStateStoreEntryReader>(); _store = new Dictionary <string, Dictionary <string, TRawState> >(); _dispatchables = new List <Dispatchable>(); _readAllResultCollector = new ReadAllResultCollector(); var dispatcherControlDelegate = new InMemoryDispatcherControlDelegate(_dispatchables); _dispatcherControl = Stage.ActorFor <IDispatcherControl>( () => new DispatcherControlActor( _dispatchers, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration)); }
public static ICompletes <AircraftState> Consign(Stage stage, Registration registration, ManufacturerSpecification manufacturerSpecification, Carrier carrier) { var address = stage.AddressFactory.UniquePrefixedWith("g-"); var aircraftActor = stage.ActorFor <IAircraft>(() => new AircraftEntity(address.IdString)); return(aircraftActor.Consign(registration, manufacturerSpecification, carrier)); }
public InMemoryStateStoreActor(IDispatcher <Dispatchable <TEntry, TRawState> > dispatcher, long checkConfirmationExpirationInterval, long confirmationExpiration) { if (dispatcher == null) { throw new ArgumentNullException(nameof(dispatcher), "Dispatcher must not be null."); } _dispatcher = dispatcher; _entryAdapterProvider = EntryAdapterProvider.Instance(Stage.World); _stateAdapterProvider = StateAdapterProvider.Instance(Stage.World); _entries = new List <TEntry>(); _entryReaders = new Dictionary <string, IStateStoreEntryReader <TEntry> >(); _store = new Dictionary <string, Dictionary <string, TRawState> >(); _dispatchables = new List <Dispatchable <TEntry, TRawState> >(); var dispatcherControlDelegate = new InMemoryDispatcherControlDelegate <TEntry, TRawState>(_dispatchables); _dispatcherControl = Stage.ActorFor <IDispatcherControl>( Definition.Has <DispatcherControlActor <TEntry, TRawState> >( Definition.Parameters( dispatcher, dispatcherControlDelegate, checkConfirmationExpirationInterval, confirmationExpiration))); }
/// <summary> /// Construct my default state. /// </summary> /// <param name="stage">This <see cref="Stage"/> of actors I create</param> /// <param name="exchangeName">The name of the exchange I feed</param> /// <param name="feederType">The type of the <see cref="IFeeder"/></param> /// <param name="entryReaderType">The <see cref="IEntryReader"/> used by the <see cref="IFeeder"/></param> internal DefaultFeed(Stage stage, string exchangeName, Type feederType, IEntryReader entryReaderType) { _exchangeName = exchangeName; _feederType = feederType; _entryReaderType = entryReaderType; _feeder = stage.ActorFor <IFeeder>(feederType, this, entryReaderType); }
public void AllocateHandlerPool(Stage stage) { for (var i = 0; i < HandlerPoolSize; ++i) { _handlerPool[i] = stage.ActorFor <IResourceRequestHandler>( () => new ResourceRequestHandlerActor(ResourceHandlerInstance(stage))); } }
/// <summary> /// Construct my default state with <param name="projectToDescriptions"></param>. /// </summary> /// <param name="projectToDescriptions">The <see cref="IEnumerable{T}"/> describing my matchable projections</param> public AbstractProjectionDispatcherActor(IEnumerable <ProjectToDescription> projectToDescriptions) : this() { foreach (var projectToDescription in projectToDescriptions) { var projection = Stage.ActorFor(projectToDescription.ProjectionDefinition); ProjectTo(projection, projectToDescription.BecauseOf); } }
public static IDirectoryService Instance( Stage stage, Node localNode, Network network, int maxMessageSize, Timing timing, int unpublishedNotifications) => stage.ActorFor <IDirectoryService>( () => new DirectoryServiceActor(localNode, network, maxMessageSize, timing, unpublishedNotifications), "vlingo-directory-service");
public void AllocateHandlerPool(Stage stage) { for (var i = 0; i < HandlerPoolSize; ++i) { _handlerPool[i] = stage.ActorFor <IResourceRequestHandler>( Definition.Has <ResourceRequestHandlerActor>( Definition.Parameters(ResourceHandlerInstance(stage)))); } }
public static IDirectoryClient Instance( Stage stage, IServiceDiscoveryInterest interest, Group directoryPublisherGroup, int maxMessageSize, long processingInterval, int processingTimeout) => stage.ActorFor <IDirectoryClient>( () => new DirectoryClientActor(interest, directoryPublisherGroup, maxMessageSize, processingInterval, processingTimeout), ClientName);
/// <summary> /// Answers a <c>Protocols</c> that provides one or more supported <paramref name="protocols"/> for the /// newly created <c>Actor</c> according to <paramref name="definition"/>. /// </summary> /// <param name="protocols">The array of protocols that the <c>Actor</c> supports.</param> /// <param name="definition">The <c>Definition</c> providing parameters to the<c>Actor</c>.</param> /// <returns></returns> public Protocols ActorFor(Type[] protocols, Definition definition) { if (IsTerminated) { throw new InvalidOperationException("vlingo-net/actors: Stopped."); } return(Stage.ActorFor(protocols, definition)); }
/// <summary> /// Answers a <c>Protocols</c> that provides one or more supported <paramref name="protocols"/> for the /// newly created <c>Actor</c> according to <paramref name="parameters"/>. /// </summary> /// <param name="protocols">The array of protocols that the <c>Actor</c> supports.</param> /// <param name="type">The type of the <code>Actor</code> to be created.</param> /// <param name="parameters">The constructor parameters for the <code>Actor</code>.</param> /// <returns></returns> public Protocols ActorFor(Type[] protocols, Type type, params object[] parameters) { if (IsTerminated) { throw new InvalidOperationException("vlingo-net/actors: Stopped."); } return(Stage.ActorFor(protocols, type, parameters)); }
/// <summary> /// Answers a new concrete <c>Actor</c> that is defined by the parameters of <paramref name="definition"/> /// and supports the protocol defined by <typeparamref name="T"/> protocol. /// </summary> /// <typeparam name="T">The protocol type.</typeparam> /// <param name="definition">The <c>Definition</c> providing parameters to the<c>Actor</c>.</param> /// <returns></returns> public T ActorFor <T>(Definition definition) { if (IsTerminated) { throw new InvalidOperationException("vlingo-net/actors: Stopped."); } return(Stage.ActorFor <T>(definition)); }
/// <summary> /// Answers the <typeparamref name="T"/> protocol of the newly created <code>Actor</code> that implements the <code>protocol</code>. /// </summary> /// <typeparam name="T">The protocol.</typeparam> /// <param name="type">The type of the <code>Actor</code>.</param> /// <param name="parameters">Constructor parameters for the <code>Actor</code>.</param> /// <returns></returns> public T ActorFor <T>(Type type, params object[] parameters) { if (IsTerminated) { throw new InvalidOperationException("vlingo/actors: Stopped."); } return(Stage.ActorFor <T>(type, parameters)); }
public static IApplicationOutboundStream Instance( Stage stage, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var applicationOutboundStream = stage.ActorFor <IApplicationOutboundStream>( () => new ApplicationOutboundStreamActor(provider, byteBufferPool), "application-outbound-stream"); return(applicationOutboundStream); }
public void InitializeUsing(Stage stage) { for (var idx = 0; idx < poolSize; ++idx) { pool[idx] = stage.ActorFor <ICompletesEventually>( Definition.Has <CompletesEventuallyActor>( Definition.NoParameters, mailboxName, "completes-eventually-" + (idx + 1))); } }
public static IServer StartWith(Stage stage, Resources resources, Filters filters, int port, Configuration.SizingConf sizing, Configuration.TimingConf timing, string severMailboxTypeName, string channelMailboxTypeName) { var server = stage.ActorFor <IServer>( () => new ServerActor(resources, filters, port, sizing, timing, channelMailboxTypeName), severMailboxTypeName, ServerActor.ServerName, stage.World.AddressFactory.WithHighId(), stage.World.DefaultLogger); server.StartUp(); return(server); }
public static IOperationalOutboundStream Instance( Stage stage, Node node, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var operationalOutboundStream = stage.ActorFor <IOperationalOutboundStream>(() => new OperationalOutboundStreamActor(node, provider, byteBufferPool), "cluster-operational-outbound-stream"); return(operationalOutboundStream); }
public static IAttributesAgent Instance( Stage stage, Node node, IClusterApplication application, IOperationalOutboundStream outbound, IConfiguration configuration) { var attributesAgent = stage.ActorFor <IAttributesAgent>( () => new AttributesAgentActor(node, application, outbound, configuration), "attributes-agent"); return(attributesAgent); }
public static IServerRequestResponseChannel Start( Stage stage, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) => stage.ActorFor <IServerRequestResponseChannel>( () => new ServerRequestResponseChannelActor(provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout));
public SsePublisherActor(string streamName, Type feedClass, int feedPayload, int feedInterval, string feedDefaultId) { _feed = Stage.ActorFor <ISseFeed>(Definition.Has(feedClass, Definition.Parameters(streamName, feedPayload, feedDefaultId))); _subscribers = new Dictionary <string, SseSubscriber>(); _cancellable = Stage.Scheduler.Schedule( SelfAs <IScheduled <object?> >(), null, TimeSpan.FromMilliseconds(10), TimeSpan.FromMilliseconds(feedInterval)); Logger.Info($"SsePublisher started for: {streamName}"); }
public InMemoryObjectStoreActor(IDispatcher <Dispatchable <TEntry, TState> > dispatcher, long checkConfirmationExpirationInterval, long confirmationExpiration) { _entryAdapterProvider = EntryAdapterProvider.Instance(Stage.World); _dispatcher = dispatcher; _entryReaders = new Dictionary <string, IObjectStoreEntryReader <IEntry <T> > >(); _storeDelegate = new InMemoryObjectStoreDelegate <TEntry, TState>(StateAdapterProvider.Instance(Stage.World)); _dispatcherControl = Stage.ActorFor <IDispatcherControl>( () => new DispatcherControlActor <TEntry, TState>(dispatcher, _storeDelegate, checkConfirmationExpirationInterval, confirmationExpiration)); }
public static ILocalLiveNode Instance( Stage stage, Node node, IClusterSnapshot snapshot, IRegistry registry, IOperationalOutboundStream outbound, IConfiguration configuration) { var localLiveNode = stage.ActorFor <ILocalLiveNode>( () => new LocalLiveNodeActor(node, snapshot, registry, outbound, configuration), "local-live-node"); return(localLiveNode); }
public static IApplicationOutboundStream Instance( Stage stage, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var definition = Definition.Has <ApplicationOutboundStreamActor>( Definition.Parameters(provider, byteBufferPool), "application-outbound-stream"); var applicationOutboundStream = stage.ActorFor <IApplicationOutboundStream>(definition); return(applicationOutboundStream); }
public static IDirectoryService Instance( Stage stage, Node localNode, Network network, int maxMessageSize, Timing timing, int unpublishedNotifications) { var definition = Definition.Has <DirectoryServiceActor>( Definition.Parameters(localNode, network, maxMessageSize, timing, unpublishedNotifications), "vlingo-directory-service"); return(stage.ActorFor <IDirectoryService>(definition)); }
public static ILocalLiveNode Instance( Stage stage, Node node, IClusterSnapshot snapshot, IRegistry registry, IOperationalOutboundStream outbound, IConfiguration configuration) { var definition = Definition.Has <LocalLiveNodeActor>( Definition.Parameters(node, snapshot, registry, outbound, configuration), "local-live-node"); var localLiveNode = stage.ActorFor <ILocalLiveNode>(definition); return(localLiveNode); }
public static IDirectoryClient Instance( Stage stage, IServiceDiscoveryInterest interest, Group directoryPublisherGroup, int maxMessageSize, long processingInterval, int processingTimeout) { var definition = Definition.Has <DirectoryClientActor>( Definition.Parameters(interest, directoryPublisherGroup, maxMessageSize, processingInterval, processingTimeout), ClientName); return(stage.ActorFor <IDirectoryClient>(definition)); }
public static IInboundStream Instance( Stage stage, IInboundStreamInterest interest, int port, AddressType addressType, string inboundName, int maxMessageSize, long probeInterval) { var reader = new SocketChannelInboundReader(port, inboundName, maxMessageSize, stage.World.DefaultLogger); var inboundStream = stage.ActorFor <IInboundStream>(() => new InboundStreamActor(interest, addressType, reader, probeInterval), $"{inboundName}-inbound"); return(inboundStream); }
public static IServerRequestResponseChannel Start( Stage stage, IAddress address, string mailboxName, IRequestChannelConsumerProvider provider, int port, string name, int processorPoolSize, int maxBufferPoolSize, int maxMessageSize, long probeInterval, long probeTimeout) => stage.ActorFor <IServerRequestResponseChannel>( () => new ServerRequestResponseChannelActor(provider, port, name, processorPoolSize, maxBufferPoolSize, maxMessageSize, probeInterval, probeTimeout), mailboxName, address.Name, address, stage.World.DefaultLogger);
public static IAttributesAgent Instance( Stage stage, Node node, IClusterApplication application, IOperationalOutboundStream outbound, IConfiguration configuration) { var definition = Definition.Has<AttributesAgentActor>( Definition.Parameters(node, application, outbound, configuration), "attributes-agent"); var attributesAgent = stage.ActorFor<IAttributesAgent>(definition); return attributesAgent; }
public static IOperationalOutboundStream Instance( Stage stage, Node node, IManagedOutboundChannelProvider provider, ConsumerByteBufferPool byteBufferPool) { var definition = Definition.Has <OperationalOutboundStreamActor>( Definition.Parameters(node, provider, byteBufferPool), "cluster-operational-outbound-stream"); var operationalOutboundStream = stage.ActorFor <IOperationalOutboundStream>(definition); return(operationalOutboundStream); }