Exemple #1
0
        public static Unit Restart()
        {
            ObservableRouter.Restart();

            ActorConfig config = ActorConfig.Default;

            if (system != null)
            {
                system.Shutdown();
            }

            Store = map(tuple("", (IProcess)null));

            // Root
            root = new Actor <Unit, object>(new ProcessId(), config.RootProcessName, Process.pub);

            // Top tier
            system = new Actor <Unit, object>(root.Id, config.SystemProcessName, Process.pub);
            self   = user = new Actor <Unit, object>(root.Id, config.UserProcessName, Process.pub);

            // Second tier
            deadLetters = new Actor <Unit, object>(system.Id, config.DeadLettersProcessName, Process.pub);

            noSender   = new Actor <Unit, object>(system.Id, config.NoSenderProcessName, Process.pub);
            registered = new Actor <Unit, object>(system.Id, config.RegisteredProcessName, Process.pub);

            return(unit);
        }
Exemple #2
0
 /// <summary>
 /// Subscribe to the process's observable stream.
 /// NOTE: The process can publish any number of types, any published messages
 ///       not of type T will be ignored.
 /// </summary>
 public static IDisposable subs <T>(ProcessId pid, Action <T> onNext, Action onComplete) =>
 ObservableRouter.Subscribe(pid, onNext, ex => { }, onComplete);
Exemple #3
0
 /// <summary>
 /// Subscribe to the process's observable stream.
 /// NOTE: The process can publish any number of types, any published messages
 ///       not of type T will be ignored.
 /// </summary>
 public static IDisposable subs <T>(ProcessId pid, Action <T> onNext, Action <Exception> onError) =>
 ObservableRouter.Subscribe(pid, onNext, onError, () => { });
Exemple #4
0
 /// <summary>
 /// Subscribe to the process's observable stream.
 /// NOTE: The process can publish any number of types, any published messages
 ///       not of type T will be ignored.
 /// </summary>
 public static IDisposable subs <T>(ProcessId pid, IObserver <T> observer) =>
 ObservableRouter.Subscribe(pid, observer);
Exemple #5
0
 /// <summary>
 /// Publish a message for any listening subscribers
 /// </summary>
 /// <param name="message">Message to publish</param>
 public static Unit pub <T>(T message) =>
 ObservableRouter.Publish(ActorContext.Self.Id, message);