Ejemplo n.º 1
0
        public HttpActorSystem(HttpClient client, JsonSerializerOptions serializer, ActorRouteMapper mapper, IActorRefMiddleware middleware = null)
        {
            if (!client.BaseAddress.AbsoluteUri.EndsWith("/"))
            {
                throw new InvalidOperationException("The base address should end with /");
            }

            this.mapper     = mapper;
            this.client     = client;
            this.serializer = serializer;
            this.middleware = middleware ?? DefaultActorRefMiddleware.Instance;
        }
Ejemplo n.º 2
0
        public static HttpActorEndpoint From(
            HttpClient client,
            JsonSerializerOptions serializer,
            ActorRouteMapper mapper,
            ActorPath path)
        {
            var mapping = mapper.FindByInterface(path.Interface);

            if (mapping == null)
            {
                throw new Exception($"Can't find actor mapping for {path.Interface}");
            }

            return(new HttpActorEndpoint(client, serializer, mapping, path.Id));
        }