protected EventStoreSubscriptionView()
        {
            _log = Context.GetLogger();

            var extension = EventStorePersistence.Instance.Apply(Context.System);
            _connection = extension.ServerSettings.Connection;

            _deserializer = extension.JournalSettings.Deserializer;
            _serializer = Context.System.Serialization.FindSerializerForType(typeof(IPersistentRepresentation));
        }
        public EventStoreJournal()
        {
            _log = Context.GetLogger();

            var serialization = Context.System.Serialization;
            _serializer = serialization.FindSerializerForType(typeof(IPersistentRepresentation));

            var extension = EventStorePersistence.Instance.Apply(Context.System);
            var journalSettings = extension.JournalSettings;
            _deserializer = journalSettings.Deserializer;

            _connection = extension.ServerSettings.Connection;
        }
Example #3
0
        public Serialization(ExtendedActorSystem system)
        {
            System = system;

            _nullSerializer = new NullSerializer(system);
            _serializers.Add(_nullSerializer.Identifier,_nullSerializer);

            var serializersConfig = system.Settings.Config.GetConfig("akka.actor.serializers").AsEnumerable().ToList();
            var serializerBindingConfig = system.Settings.Config.GetConfig("akka.actor.serialization-bindings").AsEnumerable().ToList();
            var namedSerializers = new Dictionary<string, Serializer>();
            foreach (var kvp in serializersConfig)
            {
                var serializerTypeName = kvp.Value.GetString();
                var serializerType = Type.GetType(serializerTypeName);
                if (serializerType == null)
                {
                    system.Log.Warn(string.Format("The type name for serializer '{0}' did not resolve to an actual Type: '{1}'",
                            kvp.Key, serializerTypeName));
                    continue;
                }

                var serializer = (Serializer)Activator.CreateInstance(serializerType,system);
                _serializers.Add(serializer.Identifier, serializer);
                namedSerializers.Add(kvp.Key,serializer);
            }

            foreach (var kvp in serializerBindingConfig)
            {
                var typename = kvp.Key;
                var serializerName = kvp.Value.GetString();
                var messageType = Type.GetType(typename);

                if (messageType == null)
                {

                    system.Log.Warn(string.Format(
                            "The type name for message/serializer binding '{0}' did not resolve to an actual Type: '{1}'",
                            serializerName, typename));
                    continue;
                }

                var serializer = namedSerializers[serializerName];
                if (serializer == null)
                {
                    system.Log.Warn(string.Format(
                            "Serialization binding to non existing serializer: '{0}'", serializerName));
                    continue;
                }
                _serializerMap.Add(messageType,serializer);
            }
        }
        public EventStoreSnapshotStore()
        {
            _log = Context.GetLogger();
            _extension = EventStorePersistence.Instance.Apply(Context.System);
            var serialization = Context.System.Serialization;
            _serializer = serialization.FindSerializerForType(typeof(SelectedSnapshot));

            _connection = new Lazy<Task<IEventStoreConnection>>(async () =>
            {
                IEventStoreConnection connection = EventStoreConnection.Create(_extension.EventStoreSnapshotSettings.ConnectionString, _extension.EventStoreSnapshotSettings.ConnectionName);
                await connection.ConnectAsync();
                return connection;
            });
        }
Example #5
0
        public Serialization(ActorSystem system)
        {
            System = system;
            newtonsoftJsonSerializer = new NewtonSoftJsonSerializer(system);
            //protobufnetSerializer = new ProtoBufNetSerializer(system);
            //jsonSerializer = new FastJsonSerializer(system);
            javaSerializer = new JavaSerializer(system);
            nullSerializer = new NullSerializer(system);
            byteArraySerializer = new ByteArraySerializer(system);

            serializers.Add(newtonsoftJsonSerializer.Identifier, newtonsoftJsonSerializer);
            //serializers.Add(protobufnetSerializer.Identifier, protobufnetSerializer);
            //serializers.Add(jsonSerializer.Identifier, jsonSerializer);
            serializers.Add(javaSerializer.Identifier, javaSerializer);
            serializers.Add(nullSerializer.Identifier, nullSerializer);
            serializers.Add(byteArraySerializer.Identifier, byteArraySerializer);

            serializerMap.Add(typeof (object), newtonsoftJsonSerializer);
        }
 public virtual IPersistentRepresentation GetRepresentation(Serializer serializer, RecordedEvent @event)
 {
     return (IPersistentRepresentation) serializer.FromBinary(@event.Data, typeof (IPersistentRepresentation));
 }
Example #7
0
 public void AddSerializationMap(Type type, Serializer serializer)
 {
     _serializerMap.Add(type, serializer);
 }
Example #8
0
 public void AddSerializer(Serializer serializer)
 {
     _serializers.Add(serializer.Identifier, serializer);
 }