Example #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;
        }
        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));
        }