public ClusterConfigurator Assemblies(params Assembly[] assemblies)
        {
            Requires.NotNull(assemblies, nameof(assemblies));

            if (assemblies.Length == 0)
            {
                throw new ArgumentException("Assemblies length should be greater than 0", nameof(assemblies));
            }

            foreach (var assembly in assemblies)
            {
                if (this.assemblies.Contains(assembly))
                {
                    throw new ArgumentException($"Assembly {assembly.FullName} has been already registered");
                }

                this.assemblies.Add(assembly);
            }

            foreach (var type in assemblies.SelectMany(x => x.ActorTypes()))
            {
                var mapping = ActorInterfaceMapping.Of(type);
                if (!interfaces.Add(mapping))
                {
                    throw new ArgumentException($"Actor type '{mapping.Name}' has been already registered");
                }
            }

            return(this);
        }
        internal ClientConfigurator ActorTypes(params string[] types)
        {
            Requires.NotNull(types, nameof(types));

            if (types.Length == 0)
            {
                throw new ArgumentException("types array is empty", nameof(types));
            }

            foreach (var type in types)
            {
                if (!interfaces.Add(ActorInterfaceMapping.Of(type)))
                {
                    throw new ArgumentException($"Actor type '{type}' has been already registered");
                }
            }

            return(this);
        }
Exemple #3
0
 ActorPlacementRequest(ActorPath path, ActorInterfaceMapping mapping)
 {
     Path                = path;
     CustomInterface     = mapping.CustomInterface;
     ImplementationClass = mapping.ImplementationClass;
 }
Exemple #4
0
 internal DuplicateActorTypeException(ActorInterfaceMapping existing, ActorInterfaceMapping duplicate)
     : base($"Type {duplicate.Types[0]} specifies '{existing.TypeName}' actor type code or implements same custom interface " +
            $"which has been already registered for type {existing.Types[0]}")
 {
 }