An actor implementation that can send HTTP requests to multiple hosts.
Being a layer on top of Akka HTTP's host level API, HttpRequestSender is configured with a single host, to which all requests are sent. This actor implementation overcomes this limitation by creating request actors dynamically whenever a request to a new host is encountered. All request actors managed by an instance are hold in a map, so they are reused. The creation of new child actors is done via a factory function, so it can be customized if necessary.
Note that this implementation is not intended to be used as a generic mechanism for sending arbitrary HTTP requests; keeping all the different request actors around would be rather ineffective. Some protocols, however, require that requests are sent to different hosts, for instance when file downloads are handled by a different server than other API calls.
A function type that supports the creation of new request actors. This type is used as result by RequestActorFactory. It is passed an actor context that can be used to create a new request actor reference.
A function type that supports the creation of new request actors. This type is used as result by RequestActorFactory. It is passed an actor context that can be used to create a new request actor reference.
Note that this indirection via this function type is necessary because RequestActorFactory is supposed to return a ''Future''. Running in its own thread, from this future no actors can be created (the ''spawn()'' function of ''ActorContext'' is not thread-safe).
A function type to create new request actors. This function is used by the multi-host extension when it encounters a new host for the first time to create the request actor for this host. The function is passed the URI of the current request, the configured size of the request queue, and the configured ''ProxySelectorFunc''. As collecting all the data of the new actor instance may be expensive (e.g. credentials may need to be loaded), it returns a ''Future'' with a RequestActorCreator. The multi-host extension then invokes this creator to actually create the new request actor.
A function type to create new request actors. This function is used by the multi-host extension when it encounters a new host for the first time to create the request actor for this host. The function is passed the URI of the current request, the configured size of the request queue, and the configured ''ProxySelectorFunc''. As collecting all the data of the new actor instance may be expensive (e.g. credentials may need to be loaded), it returns a ''Future'' with a RequestActorCreator. The multi-host extension then invokes this creator to actually create the new request actor.