public Remoting(ExtendedActorSystem system, RemoteActorRefProvider provider) : base(system, provider) { log = Logging.GetLogger(system, "remoting"); _eventPublisher = new EventPublisher(system, log, Logging.LogLevelFor(provider.RemoteSettings.RemoteLifecycleEventsLogLevel)); _transportSupervisor = system.SystemActorOf(Props.Create<TransportSupervisor>(), "transports"); }
public MemoryEventAdaptersSpec() { var config = ConfigurationFactory.ParseString(@" akka.persistence.journal { plugin = ""akka.persistence.journal.inmem"" # adapters defined for all plugins common-event-adapter-bindings { } inmem { # showcases re-using and concating configuration of adapters event-adapters { example = """ + typeof (ExampleEventAdapter).FullName + @", Akka.Persistence.Tests"" marker = """ + typeof (MarkerInterfaceAdapter).FullName + @", Akka.Persistence.Tests"" precise = """ + typeof (PreciseAdapter).FullName + @", Akka.Persistence.Tests"" reader = """ + typeof (ReaderAdapter).FullName + @", Akka.Persistence.Tests"" writer = """ + typeof (WriterAdapter).FullName + @", Akka.Persistence.Tests"" } event-adapter-bindings = { """ + typeof (IEventMarkerInterface).FullName + @", Akka.Persistence.Tests"" = marker ""System.String"" = example """ + typeof (PreciseAdapterEvent).FullName + @", Akka.Persistence.Tests"" = precise """ + typeof (ReadMeEvent).FullName + @", Akka.Persistence.Tests"" = reader """ + typeof (WriteMeEvent).FullName + @", Akka.Persistence.Tests"" = writer } } }").WithFallback(ConfigurationFactory.Load()); _extendedActorySystem = (ExtendedActorSystem) Sys; _memoryConfig = config.GetConfig("akka.persistence.journal.inmem"); }
public DefaultSessionManager(ExtendedActorSystem system) { if (system == null) throw new ArgumentNullException("system"); // Read configuration sections _sessionConfigs = system.Settings.Config.GetConfig("cassandra-sessions"); _sessionCache = new ConcurrentDictionary<string, Lazy<ISession>>(); }
/// <summary> /// Initializes a new instance of the <see cref="NewtonSoftJsonSerializer" /> class. /// </summary> /// <param name="system">The system.</param> public NewtonSoftJsonSerializer(ExtendedActorSystem system) : base(system) { //TODO: we should use an instanced serializer to be threadsafe for other ActorSystems JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Converters = new List<JsonConverter> { new ActorRefConverter() } }; }
public ClusterSingletonMessageSerializer(ExtendedActorSystem system) : base(system) { _identifier = SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(this.GetType(), system); _fromBinaryMap = new Dictionary<string, Func<byte[], IClusterSingletonMessage>> { {HandOverToMeManifest, _ => HandOverToMe.Instance}, {HandOverInProgressManifest, _ => HandOverInProgress.Instance}, {HandOverDoneManifest, _ => HandOverDone.Instance}, {TakeOverFromMeManifest, _ => TakeOverFromMe.Instance} }; }
public ClusterClientMessageSerializer(ExtendedActorSystem system) : base(system) { Identifier = SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(GetType(), system); _fromBinaryMap = new Dictionary<string, Func<byte[], IClusterClientMessage>> { {ContactsManifest, ContactsFromBinary}, {GetContactsManifest, _ => ClusterReceptionist.GetContacts.Instance}, {HeartbeatManifest, _ => ClusterReceptionist.Heartbeat.Instance}, {HeartbeatRspManifest, _ => ClusterReceptionist.HeartbeatRsp.Instance} }; }
public DistributedPubSubMessageSerializer(ExtendedActorSystem system) : base(system) { _identifier = SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(this.GetType(), system); _fromBinaryMap = new Dictionary<string, Func<byte[], object>> { {StatusManifest, StatusFromBinary}, {DeltaManifest, DeltaFromBinary}, {SendManifest, SendFromBinary}, {SendToAllManifest, SendToAllFromBinary}, {PublishManifest, PublishFromBinary} }; }
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 MongoDbPersistence(ExtendedActorSystem system) { if (system == null) throw new ArgumentNullException(nameof(system)); // Initialize fallback configuration defaults system.Settings.InjectTopLevelFallback(DefaultConfiguration()); // Read config var journalConfig = system.Settings.Config.GetConfig("akka.persistence.journal.mongodb"); JournalSettings = new MongoDbJournalSettings(journalConfig); var snapshotConfig = system.Settings.Config.GetConfig("akka.persistence.snapshot-store.mongodb"); SnapshotStoreSettings = new MongoDbSnapshotSettings(snapshotConfig); }
/// <summary> /// Initializes a new instance of the <see cref="NewtonSoftJsonSerializer" /> class. /// </summary> /// <param name="system">The actor system to associate with this serializer. </param> public NewtonSoftJsonSerializer(ExtendedActorSystem system) : base(system) { _settings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects, Converters = new List<JsonConverter> {new SurrogateConverter(system)}, NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore, ObjectCreationHandling = ObjectCreationHandling.Replace, //important: if reuse, the serializer will overwrite properties in default references, e.g. Props.DefaultDeploy or Props.noArgs ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, TypeNameHandling = TypeNameHandling.All, ContractResolver = new AkkaContractResolver(), }; }
public CassandraExtension(ExtendedActorSystem system) { if (system == null) throw new ArgumentNullException("system"); // Initialize fallback configuration defaults system.Settings.InjectTopLevelFallback(CassandraPersistence.DefaultConfig()); // Get or add the session manager SessionManager = CassandraSession.Instance.Apply(system); // Read config var journalConfig = system.Settings.Config.GetConfig("cassandra-journal"); JournalSettings = new CassandraJournalSettings(journalConfig); var snapshotConfig = system.Settings.Config.GetConfig("cassandra-snapshot-store"); SnapshotStoreSettings = new CassandraSnapshotStoreSettings(snapshotConfig); }
public WireSerializer(ExtendedActorSystem system) : base(system) { var akkaSurrogate = Surrogate .Create<ISurrogated, ISurrogate>( from => from.ToSurrogate(system), to => to.FromSurrogate(system)); _seralizer = new Wire.Serializer(new SerializerOptions( preserveObjectReferences: true, versionTolerance: true, surrogates: new[] { akkaSurrogate })); }
public MongoDbExtension(ExtendedActorSystem system) { if (system == null) throw new ArgumentNullException("system"); // Initialize fallback configuration defaults system.Settings.InjectTopLevelFallback(MongoDbPersistence.DefaultConfig()); // Read config var journalConfig = system.Settings.Config.GetConfig("akka.persistence.journal.mongodb"); JournalSettings = new MongoDbJournalSettings(journalConfig); var snapshotConfig = system.Settings.Config.GetConfig("akka.persistence.snapshot-store.mongodb"); SnapshotStoreSettings = new MongoDbSnapshotSettings(snapshotConfig); // Create collections var connectionString = new MongoUrl(JournalSettings.ConnectionString); var client = new MongoClient(connectionString); var journalDatabase = client.GetDatabase(connectionString.DatabaseName); JournalCollection = journalDatabase.GetCollection<JournalEntry>(JournalSettings.Collection); JournalCollection.Indexes.CreateOneAsync( Builders<JournalEntry>.IndexKeys.Ascending(entry => entry.PersistenceId) .Descending(entry => entry.SequenceNr)).Wait(); var snapshotDatabase = journalDatabase; // We only need another client if the connection strings aren't equal, // because the MongoClient uses the same connection pool for all instances which have the same connection string if (!JournalSettings.ConnectionString.Equals(SnapshotStoreSettings.ConnectionString)) { connectionString = new MongoUrl(SnapshotStoreSettings.ConnectionString); client = new MongoClient(connectionString); snapshotDatabase = client.GetDatabase(connectionString.DatabaseName); } SnapshotCollection = snapshotDatabase.GetCollection<SnapshotEntry>(SnapshotStoreSettings.Collection); SnapshotCollection.Indexes.CreateOneAsync( Builders<SnapshotEntry>.IndexKeys.Ascending(entry => entry.PersistenceId) .Descending(entry => entry.SequenceNr)).Wait(); }
public ClusterShardingMessageSerializer(ExtendedActorSystem system) : base(system) { _system = system; _identifier = SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(this.GetType(), system); _fromBinaryMap = new Dictionary<string, Func<byte[], object>> { {EntityStateManifest, EntityStateFromBinary}, {EntityStartedManifest, EntityStartedFromBinary}, {EntityStoppedManifest, EntityStoppedFromBinary}, {CoordinatorStateManifest, CoordinatorStateFromBinary}, {ShardRegionRegisteredManifest, bytes => new PersistentShardCoordinator.ShardRegionRegistered(ActorRefMessageFromBinary(bytes)) }, {ShardRegionProxyRegisteredManifest, bytes => new PersistentShardCoordinator.ShardRegionProxyRegistered(ActorRefMessageFromBinary(bytes)) }, {ShardRegionTerminatedManifest, bytes => new PersistentShardCoordinator.ShardRegionTerminated(ActorRefMessageFromBinary(bytes)) }, {ShardRegionProxyTerminatedManifest, bytes => new PersistentShardCoordinator.ShardRegionProxyTerminated(ActorRefMessageFromBinary(bytes)) }, {ShardHomeAllocatedManifest, ShardHomeAllocatedFromBinary}, {ShardHomeDeallocatedManifest, bytes => new PersistentShardCoordinator.ShardHomeDeallocated(ShardIdMessageFromBinary(bytes)) }, {RegisterManifest, bytes => new PersistentShardCoordinator.Register(ActorRefMessageFromBinary(bytes)) }, {RegisterProxyManifest, bytes => new PersistentShardCoordinator.RegisterProxy(ActorRefMessageFromBinary(bytes)) }, {RegisterAckManifest, bytes => new PersistentShardCoordinator.RegisterAck(ActorRefMessageFromBinary(bytes)) }, {GetShardHomeManifest, bytes => new PersistentShardCoordinator.GetShardHome(ShardIdMessageFromBinary(bytes)) }, {ShardHomeManifest, ShardHomeFromBinary}, {HostShardManifest, bytes => new PersistentShardCoordinator.HostShard(ShardIdMessageFromBinary(bytes)) }, {ShardStartedManifest, bytes => new PersistentShardCoordinator.ShardStarted(ShardIdMessageFromBinary(bytes)) }, {BeginHandOffManifest, bytes => new PersistentShardCoordinator.BeginHandOff(ShardIdMessageFromBinary(bytes)) }, {BeginHandOffAckManifest, bytes => new PersistentShardCoordinator.BeginHandOffAck(ShardIdMessageFromBinary(bytes)) }, {HandOffManifest, bytes => new PersistentShardCoordinator.HandOff(ShardIdMessageFromBinary(bytes)) }, {ShardStoppedManifest, bytes => new PersistentShardCoordinator.ShardStopped(ShardIdMessageFromBinary(bytes)) }, {GracefulShutdownReqManifest, bytes => new PersistentShardCoordinator.GracefulShutdownRequest(ActorRefMessageFromBinary(bytes)) }, {GetShardStatsManifest, bytes => Shard.GetShardStats.Instance }, {ShardStatsManifest, bytes => ShardStatsFromBinary(bytes)} }; }
/// <summary> /// Creates an actor system extension for akka persistence Azure Storage support. /// </summary> /// <param name="system"></param> /// <returns></returns> public override EventStorePersistenceExtension CreateExtension(ExtendedActorSystem system) { return(new EventStorePersistenceExtension(system)); }
public FailureInjectorTransportAdapter(Transport wrappedTransport, ExtendedActorSystem extendedActorSystem) : base(wrappedTransport) { ExtendedActorSystem = extendedActorSystem; _log = Logging.GetLogger(ExtendedActorSystem, this); _shouldDebugLog = ExtendedActorSystem.Settings.Config.GetBoolean("akka.remote.gremlin.debug"); }
/// <summary> /// TBD /// </summary> /// <param name="system">TBD</param> /// <returns>TBD</returns> public override DistributedPubSub CreateExtension(ExtendedActorSystem system) { return(new DistributedPubSub(system)); }
/// <summary> /// Initializes a new instance of the <see cref="Serializer" /> class. /// </summary> /// <param name="system">The actor system to associate with this serializer. </param> public Serializer(ExtendedActorSystem system) { this.system = system; }
/// <summary> /// Initializes a new instance of the <see cref="NullSerializer" /> class. /// </summary> /// <param name="system">The actor system to associate with this serializer. </param> public NullSerializer(ExtendedActorSystem system) : base(system) { }
public DaemonMsgCreateSerializer(ExtendedActorSystem system) : base(system) { }
public MySnapshotSerializer(ExtendedActorSystem system) : base(system) { }
public DebugHyperionSerializer(ExtendedActorSystem system) : base(system) { }
public override ServiceProviderExtension CreateExtension(ExtendedActorSystem system) => new ServiceProviderExtension();
//TODO: //override def lookup = TestConductor public override TestConductor CreateExtension(ExtendedActorSystem system) { return(new TestConductor(system)); }
public override SqlServerPersistence CreateExtension(ExtendedActorSystem system) { return(new SqlServerPersistence(system)); }
public override ActorPathThreadLocalCache CreateExtension(ExtendedActorSystem system) { return(new ActorPathThreadLocalCache()); }
public WrappedPayloadSupport(ExtendedActorSystem system) { _system = system; }
/// <summary> /// Initializes a new instance of the <see cref="ProtobufSerializer"/> class. /// </summary> /// <param name="system">The actor system to associate with this serializer. </param> public ProtobufSerializer(ExtendedActorSystem system) : base(system) { }
public OldPayloadSerializer(ExtendedActorSystem system) : base(system) { }
public override AddressThreadLocalCache CreateExtension(ExtendedActorSystem system) { return new AddressThreadLocalCache(); }
public NewtonSoftJsonSerializer(ExtendedActorSystem system, Config config) : this(system, NewtonSoftJsonSerializerSettings.Create(config)) { }
/// <summary> /// Creates the <see cref="AddressTerminatedTopic"/> extension using a given actor system. /// </summary> /// <param name="system">The actor system to use when creating the extension.</param> /// <returns>The extension created using the given actor system.</returns> public override AddressTerminatedTopic CreateExtension(ExtendedActorSystem system) { return(new AddressTerminatedTopic()); }
public static int GetSerializerIdentifierFromConfig(Type type, ExtendedActorSystem system) { var config = system.Settings.Config.GetConfig(SerializationIdentifiers); var identifiers = config.AsEnumerable() .ToDictionary(pair => Type.GetType(pair.Key, true), pair => pair.Value.GetInt()); int value; if (identifiers.TryGetValue(type, out value)) { return value; } else { throw new ArgumentException(string.Format("Couldn't find serializer id for [{0}] under [{1}] HOCON path", type, SerializationIdentifiers)); } }
/// <summary> /// Initializes a new instance of the <see cref="SerializerWithStringManifest"/> class. /// </summary> /// <param name="system">The actor system to associate with this serializer.</param> protected SerializerWithStringManifest(ExtendedActorSystem system) : base(system) { }
/// <summary> /// Initializes a new instance of the <see cref="MessageContainerSerializer"/> class. /// </summary> /// <param name="system">The actor system to associate with this serializer. </param> public MessageContainerSerializer(ExtendedActorSystem system) : base(system) { }
/// <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)); }
public ShardedDaemonProcess(ExtendedActorSystem system) => _system = system;
/// <summary> /// TBD /// </summary> /// <param name="system">TBD</param> /// <returns>TBD</returns> public override TestKitAssertionsProvider CreateExtension(ExtendedActorSystem system) { return(new TestKitAssertionsProvider(_assertions)); }
/// <summary> /// Creates an actor system extension for akka persistence MySql support. /// </summary> /// <param name="system"></param> /// <returns></returns> public override MySqlPersistence CreateExtension(ExtendedActorSystem system) { return(new MySqlPersistence(system)); }
/// <summary> /// Creates the cluster extension using a given actor system. /// </summary> /// <param name="system">The actor system to use when creating the extension.</param> /// <returns>The extension created using the given actor system.</returns> public override Cluster CreateExtension(ExtendedActorSystem system) { return(new Cluster((ActorSystemImpl)system)); }
public Transport Create(Transport wrappedTransport, ExtendedActorSystem system) { return new FailureInjectorTransportAdapter(wrappedTransport, system); }
public override ClusterDiscovery CreateExtension(ExtendedActorSystem system) { return(new ClusterDiscovery(system)); }
/// <summary> /// Initializes a new instance of the <see cref="ByteArraySerializer" /> class. /// </summary> /// <param name="system"> The system. </param> public ByteArraySerializer(ExtendedActorSystem system) : base(system) { }
public DummyConfigurableSerializer(ExtendedActorSystem system) : base(system) { }
public ClusterClientMessageSerializer(ExtendedActorSystem system) : base(system) { _identifier = SerializerIdentifierHelper.GetSerializerIdentifierFromConfig(this.GetType(), system); }
public DummyConfigurableSerializer(ExtendedActorSystem system, Config config) : base(system) { Config = config; }
public MyPayload2Serializer(ExtendedActorSystem system) : base(system) { }
/// <summary> /// TBD /// </summary> /// <param name="system">TBD</param> /// <returns>TBD</returns> public override DistributedData CreateExtension(ExtendedActorSystem system) => new DistributedData(system);
protected RemoteTransport(ExtendedActorSystem system, RemoteActorRefProvider provider) { System = system; Provider = provider; }
public DummySerializer(ExtendedActorSystem system) : base(system) { }
/// <summary> /// Initializes a new instance of the <see cref="NewtonSoftJsonSerializer" /> class. /// </summary> /// <param name="system">The actor system to associate with this serializer. </param> public NewtonSoftJsonSerializer(ExtendedActorSystem system) : this(system, NewtonSoftJsonSerializerSettings.Default) { }
public override FailingTestExtensionImpl CreateExtension(ExtendedActorSystem system) { return(new FailingTestExtensionImpl(system)); }
protected SerializerWithStringManifest(ExtendedActorSystem system) : base(system) { }
public override OtherTestExtensionImpl CreateExtension(ExtendedActorSystem system) { return(new OtherTestExtensionImpl(system)); }
public override RARP CreateExtension(ExtendedActorSystem system) { return(new RARP(system.Provider.AsInstanceOf <RemoteActorRefProvider>())); }
public static IMetricsCollector Get(ExtendedActorSystem system, ClusterSettings settings) { var fqcn = settings.MetricsCollectorClass; if (fqcn == typeof (PerformanceCounterMetricsCollector).AssemblyQualifiedName) return new PerformanceCounterMetricsCollector(system); var metricsCollectorClass = Type.GetType(fqcn); if (metricsCollectorClass == null) { throw new ConfigurationException(string.Format("Could not create custom metrics collector {0}", fqcn)); } try { var metricsCollector = (IMetricsCollector) Activator.CreateInstance(metricsCollectorClass, system); return metricsCollector; } catch (Exception ex) { throw new ConfigurationException(string.Format("Could not create custom metrics collector {0} because: {1}", fqcn, ex.Message)); } }
public override ShardedDaemonProcess CreateExtension(ExtendedActorSystem system) => new ShardedDaemonProcess(system);
public SqlReadJournal(ExtendedActorSystem system, Config config) { _refreshInterval = config.GetTimeSpan("refresh-interval"); _writeJournalPluginId = config.GetString("write-plugin"); _maxBufferSize = config.GetInt("max-buffer-size"); }