Пример #1
0
        protected internal void Configure(IDictionary <string, ProviderCategoryConfiguration> providerConfigurations)
        {
            if (providerConfigurations.ContainsKey("Stream"))
            {
                var providers = providerConfigurations["Stream"];
                StreamPath.Register(providers.Providers.Values);
            }

            if (serializer != null)
            {
                var instance = (IMessageSerializer)Activator.CreateInstance(serializer.Item1);
                instance.Init(assemblies.ToArray(), serializer.Item2 ?? new Dictionary <string, string>());

                MessageEnvelope.Serializer = instance;
            }

            if (activator != null)
            {
                var instance = (IActorActivator)Activator.CreateInstance(activator.Item1);
                instance.Init(activator.Item2);

                ActorEndpoint.Activator = instance;
            }

            ActorAssembly.Register(assemblies);
        }
Пример #2
0
 public void Dispose()
 {
     StreamPath.Reset();
     MessageEnvelope.Reset();
     ActorEndpoint.Reset();
     ActorAssembly.Reset();
 }
Пример #3
0
        public StreamRef StreamOf(StreamPath path)
        {
            if (path == StreamPath.Empty)
                throw new ArgumentException("Stream path is empty", nameof(path));

            return StreamRef.Deserialize(path);
        }
Пример #4
0
        static object Deserialize(Type t, IDeserializationContext context)
        {
            var reader  = context.StreamReader;
            var path    = StreamPath.Parse(reader.ReadString());
            var manager = context.ServiceProvider.GetRequiredService <IStreamProviderManager>();

            return(new StreamRef(path, manager.GetStreamProvider(path.Provider)));
        }
Пример #5
0
        static object Deserialize(Type t, IDeserializationContext context)
        {
            var reader   = context.StreamReader;
            var path     = StreamPath.Parse(reader.ReadString());
            var provider = context.ServiceProvider.GetServiceByName <IStreamProvider>(path.Provider);

            return(new StreamRef(path, provider));
        }
Пример #6
0
        public StreamRef StreamOf(StreamPath path)
        {
            if (path == StreamPath.Empty)
            {
                throw new ArgumentException("Stream path is empty", "path");
            }

            return(StreamRef.Deserialize(path));
        }
Пример #7
0
        /// <inheritdoc />
        public StreamRef <TItem> StreamOf <TItem>(StreamPath path)
        {
            if (path == StreamPath.Empty)
            {
                throw new ArgumentException("Stream path is empty", nameof(path));
            }

            var provider = serviceProvider.GetServiceByName <IStreamProvider>(path.Provider);

            return(new StreamRef <TItem>(path, provider));
        }
Пример #8
0
        /// <inheritdoc />
        public StreamRef StreamOf(StreamPath path)
        {
            if (path == StreamPath.Empty)
            {
                throw new ArgumentException("Stream path is empty", nameof(path));
            }

            var provider = StreamProviderManager.GetStreamProvider(path.Provider);

            return(new StreamRef(path, provider));
        }
Пример #9
0
 /// <summary>
 /// Acquires the stream reference for the given provider name and id of the stream.
 /// </summary>
 /// <param name="system">The reference to actor system</param>
 /// <param name="provider">The name of the stream provider</param>
 /// <param name="id">The id</param>
 /// <typeparam name="TItem">The type of the stream item</typeparam>
 /// <returns>A stream reference</returns>
 public static StreamRef <TItem> StreamOf <TItem>(this IActorSystem system, string provider, string id)
 {
     return(system.StreamOf <TItem>(StreamPath.From(provider, id)));
 }
Пример #10
0
 protected internal StreamRef(StreamPath path)
 {
     Path = path;
 }
Пример #11
0
 public static StreamRef Deserialize(StreamPath path) => new StreamRef(path);
Пример #12
0
        public StreamRef(SerializationInfo info, StreamingContext context)
        {
            var value = (string)info.GetValue("path", typeof(string));

            Path = StreamPath.Deserialize(value);
        }
Пример #13
0
 StreamRef(StreamPath path, IAsyncStream <object> endpoint)
 {
     this.path     = path;
     this.endpoint = endpoint;
 }
Пример #14
0
 internal StreamRef(StreamPath path, IStreamProvider provider, IStreamRefMiddleware middleware)
     : this(path)
 {
     this.provider   = provider;
     this.middleware = middleware;
 }
Пример #15
0
 public static StreamRef Deserialize(string path) => Deserialize(StreamPath.Deserialize(path));
Пример #16
0
 /// <summary>
 /// Acquires the stream reference for the given id and type of the stream.
 /// </summary>
 /// <param name="system">The reference to actor system</param>
 /// <param name="provider">The name of the stream provider</param>
 /// <param name="id">The id</param>
 /// <returns>A stream reference</returns>
 public static StreamRef StreamOf(this IActorSystem system, string provider, string id)
 {
     return system.StreamOf(StreamPath.From(provider, id));
 }
Пример #17
0
 /// <summary>
 /// Acquires the stream reference for the given id and type of the stream.
 /// </summary>
 /// <typeparam name="TStream">The type of the stream</typeparam>
 /// <param name="system">The reference to actor system</param>
 /// <param name="id">The id</param>
 /// <returns>A stream reference</returns>
 public static StreamRef StreamOf <TStream>(this IActorSystem system, string id) where TStream : IStreamProvider
 {
     return(system.StreamOf(StreamPath.From(typeof(TStream), id)));
 }
Пример #18
0
 public bool Equals(StreamPath other) => Path.Equals(other);
Пример #19
0
 public static StreamRef Deserialize(StreamPath path)
 {
     return(new StreamRef(path, path.Proxy()));
 }
Пример #20
0
 protected internal StreamRef(StreamPath path, IStreamProvider provider = null)
 {
     Path          = path;
     this.provider = provider;
 }
Пример #21
0
 protected StreamRef(StreamPath path)
 {
     Path = path;
 }