示例#1
0
        private Serializer GetSerializerByName(string name)
        {
            if (name == null)
            {
                return(null);
            }

            var serializersConfig = System.Settings.Config.GetConfig("akka.actor.serializers").AsEnumerable().ToList();

            foreach (var kvp in serializersConfig)
            {
                if (kvp.Key.Equals(name))
                {
                    var serializerTypeName = kvp.Value.GetString();
                    var serializerType     = Type.GetType(serializerTypeName);

                    var serializerId = SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(serializerType, (ExtendedActorSystem)System);
                    return(GetSerializerById(serializerId));
                }
            }
            return(null);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Serializer" /> class.
 /// </summary>
 /// <param name="system">The actor system to associate with this serializer. </param>
 protected Serializer(ExtendedActorSystem system)
 {
     this.system = system;
     _value      = new FastLazy <int>(() => SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(GetType(), system));
 }