public EventStoreJournal() { _log = Context.GetLogger(); _extension = EventStorePersistence.Instance.Apply(Context.System); _serializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects, TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple, Formatting = Formatting.Indented, Converters = { new ActorRefConverter(Context) } }; _connection = new Lazy<Task<IEventStoreConnection>>(async () => { try { IEventStoreConnection connection = EventStoreConnection.Create(_extension.EventStoreJournalSettings.ConnectionString, _extension.EventStoreJournalSettings.ConnectionName); await connection.ConnectAsync(); return connection; } catch(Exception exc) { _log.Error(exc.ToString()); return null; } }); }
public EventStoreJournal() { _log = Context.GetLogger(); _extension = EventStorePersistence.Instance.Apply(Context.System); _serializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects, TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple, Formatting = Formatting.Indented, Converters = { new ActorRefConverter(Context) } }; _connection = new Lazy <Task <IEventStoreConnection> >(async() => { try { IEventStoreConnection connection = EventStoreConnection.Create(_extension.EventStoreJournalSettings.ConnectionString, _extension.EventStoreJournalSettings.ConnectionName); await connection.ConnectAsync(); return(connection); } catch (Exception exc) { _log.Error(exc.ToString()); return(null); } }); }
public EventStoreSnapshotStore() { _log = Context.GetLogger(); _extension = EventStorePersistence.Instance.Apply(Context.System); var serialization = Context.System.Serialization; _serializer = serialization.FindSerializerForType(typeof(SnapshotRepresentation)); _connection = new Lazy <Task <IEventStoreConnection> >(async() => { IEventStoreConnection connection = EventStoreConnection.Create( _extension.EventStoreSnapshotSettings.ConnectionString, _extension.EventStoreSnapshotSettings.ConnectionName); //connection.Settings.Log = Logger.EventStoreLogger.Create(_log); connection.ErrorOccurred += (object sender, ClientErrorEventArgs e) => { _log.Debug("Event Store Connected Error", e.Exception.Message); }; connection.Reconnecting += (object sender, ClientReconnectingEventArgs e) => { _log.Debug("Event Store Reconnecting"); }; await connection.ConnectAsync(); return(connection); }); }
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; }); }
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); }); }
public EventStoreJournal() { _log = Context.GetLogger(); _extension = EventStorePersistence.Instance.Apply(Context.System); var journalConverters = new List <JsonConverter>(); foreach (var converterString in _extension.EventStoreJournalSettings.TypeConverterClasses) { var converterType = Type.GetType(converterString, false); if (converterType == null) { } else { // Only try to create type converters if (typeof(JsonConverter).IsAssignableFrom(converterType)) { var converter = Activator.CreateInstance(converterType) as JsonConverter; if (converter != null) { journalConverters.Add(converter); } } } } journalConverters.Add(new ActorRefConverter(Context)); journalSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.None, // TypeNameHandling.Objects, TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple, Formatting = Formatting.Indented, Converters = journalConverters, ContractResolver = JournalDataDataContractResolver.Instance, NullValueHandling = NullValueHandling.Ignore }; metaDataSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.None, TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple, Formatting = Formatting.Indented, Converters = { new ActorRefConverter(Context) }, //ContractResolver = MetaDataDataContractResolver.Instance, NullValueHandling = NullValueHandling.Ignore }; _connection = new Lazy <Task <IEventStoreConnection> >(async() => { try { //var builder = ConnectionSettings.Create().Build(); var connection = EventStoreConnection.Create( _extension.EventStoreJournalSettings.ConnectionString, _extension.EventStoreJournalSettings.ConnectionName ); await connection.ConnectAsync(); return(connection); } catch (Exception exc) { _log.Error(exc.ToString()); return(null); } }); }