Example #1
0
        public static void RegisterActorSystem(this ContainerBuilder builder, AkkaActorSystem akkaActorSystem)
        {
            var actorFinder = new ActorFinder(akkaActorSystem);
            var actorSystem = new ActorSystem(akkaActorSystem.Name, actorFinder);

            builder.RegisterInstance <ActorSystem>(actorSystem);
        }
Example #2
0
        private static AkkaActorSystem CreateAkkaActorSystem()
        {
            var actorSystem = AkkaActorSystem.Create(ActorSystemName);

            actorSystem.ActorOf <GreetingActor>("greeting");
            actorSystem.ActorOf <EchoActor>("echo");
            return(actorSystem);
        }
Example #3
0
        public void TestSetup()
        {
            Akka.Actor.ActorSystem system = Sys;
            var config       = TestKit.DefaultConfig;
            var akkaSettings = new Akka.Actor.Settings(system, config);

            uut = new RemoteNodeMailbox(akkaSettings, config);
        }
Example #4
0
        static void Main(string[] args)
        {
            actorSystem = Akka.Actor.ActorSystem.Create("Maddog19");
            //IActorRef worker = actorSystem.ActorOf<WorkerActor>("Worker");
            //IActorRef client = actorSystem.ActorOf<ClientActor>("Client");
            //client.Tell(new DoSomeWork(1));


            IActorRef worker = actorSystem.ActorOf <FsmWorkerActor>("FsmWorker");

            worker.Tell(new NewWorkArrived(1));
            worker.Tell(new NewWorkArrived(2));
            worker.Tell(new NewWorkArrived(3));
            // worker.Tell(new StopBlocking());
            while (1 == 1)
            {
            }
        }
 /// <summary>
 /// Creates a <see cref="OneForOneStrategy"/> encapsulated by this surrogate.
 /// </summary>
 /// <param name="system">The actor system that owns this router.</param>
 /// <returns>The <see cref="OneForOneStrategy"/> encapsulated by this surrogate.</returns>
 public ISurrogated FromSurrogate(ActorSystem system)
 {
     return(new AllForOneStrategy(MaxNumberOfRetries, WithinTimeRangeMilliseconds, Decider, LoggingEnabled));
 }
 /// <summary>
 /// Creates a surrogate representation of the current <see cref="SupervisorStrategy"/>.
 /// </summary>
 /// <param name="system">The actor system that owns this router.</param>
 /// <returns>The surrogate representation of the current <see cref="SupervisorStrategy"/>.</returns>
 public abstract ISurrogate ToSurrogate(ActorSystem system);
Example #7
0
 public ISurrogate ToSurrogate(ActorSystem system)
 {
     return(new Surrogate(ToSerializationFormat()));
 }
Example #8
0
 /// <summary>
 ///     Construct an <see cref="Akka.Actor.ActorSelection"/> from the given path, which is
 ///     parsed for wildcards (these are replaced by regular expressions
 ///     internally). No attempt is made to verify the existence of any part of
 ///     the supplied path, it is recommended to send a message and gather the
 ///     replies in order to resolve the matching set of actors.
 /// </summary>
 public static ActorSelection ActorSelection(ActorPath actorPath, ActorSystem system)
 {
     return(new ActorSelection(((ActorSystemImpl)system).Provider.RootGuardianAt(actorPath.Address), actorPath.Elements));
 }
Example #9
0
 /// <summary>
 /// Creates a <see cref="Props"/> encapsulated by this surrogate.
 /// </summary>
 /// <param name="system">The actor system that owns this router.</param>
 /// <returns>The <see cref="Props"/> encapsulated by this surrogate.</returns>
 public ISurrogated FromSurrogate(ActorSystem system)
 {
     return(new Props(Deploy, Type, Arguments));
 }
Example #10
0
 /// <summary>
 /// Retrieves the extension specified by a given type, <typeparamref name="T"/>, from a given actor system.
 /// </summary>
 /// <typeparam name="T">The type associated with the extension to retrieve.</typeparam>
 /// <param name="system">The actor system from which to retrieve the extension.</param>
 /// <returns>The extension retrieved from the given actor system.</returns>
 public static T WithExtension <T>(this ActorSystem system) where T : class, IExtension
 {
     return(system.GetExtension <T>());
 }
Example #11
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="system">TBD</param>
 /// <returns>TBD</returns>
 public override ISurrogate ToSurrogate(ActorSystem system)
 {
     return(SurrogateInstance);
 }
Example #12
0
 /// <summary>
 /// Registers the current extension to a given actor system.
 /// </summary>
 /// <param name="system">The actor system in which to register the extension.</param>
 /// <returns>The extension registered to the given actor system.</returns>
 public T Apply(ActorSystem system)
 {
     return((T)system.RegisterExtension(this));
 }
Example #13
0
 object IExtensionId.Get(ActorSystem system)
 {
     return(Get(system));
 }
Example #14
0
 public ISurrogated FromSurrogate(ActorSystem system)
 {
     return(new Address(Protocol, System, Host, Port));
 }
Example #15
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Settings" /> class.
        /// </summary>
        /// <param name="system">The system.</param>
        /// <param name="config">The configuration.</param>
        public Settings(ActorSystem system, Config config)
        {
            _userConfig     = config;
            _fallbackConfig = ConfigurationFactory.Default();
            RebuildConfig();

            System = system;

            ConfigVersion = Config.GetString("akka.version");
            ProviderClass = Config.GetString("akka.actor.provider");
            var providerType = Type.GetType(ProviderClass);

            if (providerType == null)
            {
                throw new ConfigurationException(string.Format("'akka.actor.provider' is not a valid type name : '{0}'", ProviderClass));
            }
            if (!typeof(IActorRefProvider).IsAssignableFrom(providerType))
            {
                throw new ConfigurationException(string.Format("'akka.actor.provider' is not a valid actor ref provider: '{0}'", ProviderClass));
            }

            SupervisorStrategyClass = Config.GetString("akka.actor.guardian-supervisor-strategy");

            AskTimeout           = Config.GetTimeSpan("akka.actor.ask-timeout", allowInfinite: true);
            CreationTimeout      = Config.GetTimeSpan("akka.actor.creation-timeout");
            UnstartedPushTimeout = Config.GetTimeSpan("akka.actor.unstarted-push-timeout");

            SerializeAllMessages = Config.GetBoolean("akka.actor.serialize-messages");
            SerializeAllCreators = Config.GetBoolean("akka.actor.serialize-creators");

            LogLevel       = Config.GetString("akka.loglevel");
            StdoutLogLevel = Config.GetString("akka.stdout-loglevel");
            Loggers        = Config.GetStringList("akka.loggers");

            LoggerStartTimeout = Config.GetTimeSpan("akka.logger-startup-timeout");

            //handled
            LogConfigOnStart = Config.GetBoolean("akka.log-config-on-start");
            LogDeadLetters   = 0;
            switch (Config.GetString("akka.log-dead-letters"))
            {
            case "on":
            case "true":
                LogDeadLetters = int.MaxValue;
                break;

            case "off":
            case "false":
                LogDeadLetters = 0;
                break;

            default:
                LogDeadLetters = Config.GetInt("akka.log-dead-letters");
                break;
            }
            LogDeadLettersDuringShutdown = Config.GetBoolean("akka.log-dead-letters-during-shutdown");
            AddLoggingReceive            = Config.GetBoolean("akka.actor.debug.receive");
            DebugAutoReceive             = Config.GetBoolean("akka.actor.debug.autoreceive");
            DebugLifecycle              = Config.GetBoolean("akka.actor.debug.lifecycle");
            FsmDebugEvent               = Config.GetBoolean("akka.actor.debug.fsm");
            DebugEventStream            = Config.GetBoolean("akka.actor.debug.event-stream");
            DebugUnhandledMessage       = Config.GetBoolean("akka.actor.debug.unhandled");
            DebugRouterMisconfiguration = Config.GetBoolean("akka.actor.debug.router-misconfiguration");
            Home = Config.GetString("akka.home") ?? "";
            DefaultVirtualNodesFactor = Config.GetInt("akka.actor.deployment.default.virtual-nodes-factor");

            SchedulerClass = Config.GetString("akka.scheduler.implementation");
            //TODO: dunno.. we dont have FiniteStateMachines, dont know what the rest is

            /*
             *  final val SchedulerClass: String = getString("akka.scheduler.implementation")
             *  final val Daemonicity: Boolean = getBoolean("akka.daemonic")
             *  final val DefaultVirtualNodesFactor: Int = getInt("akka.actor.deployment.default.virtual-nodes-factor")
             */
        }
Example #16
0
 /// <summary>
 /// Creates a <see cref="Deploy"/> encapsulated by this surrogate.
 /// </summary>
 /// <param name="system">The actor system that owns this router.</param>
 /// <returns>The <see cref="Deploy"/> encapsulated by this surrogate.</returns>
 public ISurrogated FromSurrogate(ActorSystem system)
 {
     return(new Deploy(Path, Config, RouterConfig, Scope, Dispatcher, Mailbox));
 }
Example #17
0
 /// <summary>
 /// Creates a surrogate representation of the current <see cref="ActorRefBase"/>.
 /// </summary>
 /// <param name="system">The actor system that references this <see cref="ActorRefBase"/>.</param>
 /// <returns>The surrogate representation of the current <see cref="ActorRefBase"/>.</returns>
 public virtual ISurrogate ToSurrogate(ActorSystem system)
 {
     return(new Surrogate(Serialization.Serialization.SerializedActorPath(this)));
 }
Example #18
0
 /// <summary>
 /// Creates an <see cref="ActorRefBase"/> encapsulated by this surrogate.
 /// </summary>
 /// <param name="system">The actor system that contains this <see cref="ActorRefBase"/>.</param>
 /// <returns>The <see cref="ActorRefBase"/> encapsulated by this surrogate.</returns>
 public ISurrogated FromSurrogate(ActorSystem system)
 {
     return(((ActorSystemImpl)system).Provider.ResolveActorRef(Path));
 }
Example #19
0
 object IExtensionId.Apply(ActorSystem system)
 {
     return(Apply(system));
 }
Example #20
0
 /// <summary>
 /// Converts the <see cref="ISurrogate"/> into a <see cref="IActorRef"/>.
 /// </summary>
 /// <param name="system">The actor system.</param>
 /// <returns>TBD</returns>
 public ISurrogated FromSurrogate(ActorSystem system)
 {
     return(Nobody.Instance);
 }
Example #21
0
 /// <summary>
 /// Retrieves the current extension from a given actor system.
 /// </summary>
 /// <param name="system">The actor system from which to retrieve the extension.</param>
 /// <returns>The extension retrieved from the given actor system.</returns>
 public T Get(ActorSystem system)
 {
     return((T)system.GetExtension(this));
 }
Example #22
0
 /// <summary>
 /// Creates a surrogate representation of the current <see cref="LocalScope"/>.
 /// </summary>
 /// <param name="system">The actor system that owns this router.</param>
 /// <returns>The surrogate representation of the current <see cref="LocalScope"/>.</returns>
 public ISurrogate ToSurrogate(ActorSystem system)
 {
     return(new LocalScopeSurrogate());
 }