Esempio n. 1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Mailboxes" /> class.
        /// </summary>
        /// <param name="system">The system.</param>
        public Mailboxes(ActorSystem system)
        {
            _system            = system;
            _deadLetterMailbox = new DeadLetterMailbox(system.DeadLetters);
            var mailboxConfig = system.Settings.Config.GetConfig("akka.actor.mailbox");

            if (mailboxConfig.IsNullOrEmpty())
            {
                throw ConfigurationException.NullOrEmptyConfig <Mailboxes>("akka.actor.mailbox");
            }

            var requirements = mailboxConfig.GetConfig("requirements").AsEnumerable().ToList();

            _mailboxBindings = new Dictionary <Type, string>();
            foreach (var kvp in requirements)
            {
                var type = Type.GetType(kvp.Key);
                if (type == null)
                {
                    Warn($"Mailbox Requirement mapping [{kvp.Key}] is not an actual type");
                    continue;
                }
                _mailboxBindings.Add(type, kvp.Value.GetString());
            }

            _defaultMailboxConfig = Settings.Config.GetConfig(DefaultMailboxId);
        }
Esempio n. 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Mailboxes" /> class.
        /// </summary>
        /// <param name="system">The system.</param>
        public Mailboxes(ActorSystem system)
        {
            _system            = system;
            _deadLetterMailbox = new DeadLetterMailbox(system.DeadLetters);
            var mailboxConfig = system.Settings.Config.GetConfig("akka.actor.mailbox");
            var requirements  = mailboxConfig.GetConfig("requirements").AsEnumerable().ToList();

            _requirementsMapping = new Dictionary <Type, Config>();
            foreach (var kvp in requirements)
            {
                var type = Type.GetType(kvp.Key);
                if (type == null)
                {
                    //TODO: can't log here, logger not created yet
                    //  system.Log.Warn("Mailbox Requirement mapping '{0}' is not an actual type",kvp.Key);
                    continue;
                }
                var config = system.Settings.Config.GetConfig(kvp.Value.GetString());
                _requirementsMapping.Add(type, config);
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Mailboxes" /> class.
 /// </summary>
 /// <param name="system">The system.</param>
 public Mailboxes(ActorSystem system)
 {
     this.system        = system;
     _deadLetterMailbox = new DeadLetterMailbox(system.DeadLetters);
 }