HttpRequestSenderFactory

com.github.cloudfiles.core.http.factory.HttpRequestSenderFactory

A trait to simplify the creation and configuration of actors for sending HTTP requests.

The ''http'' package provides several extension actors to modify the behavior of a plain HttpRequestSender actor, including support for multiple authentication schemes. Usage of these features requires the creation of multiple actors, which are then plugged together.

This trait supports a more declarative way of constructing HTTP request sender actors. The idea is to define the desired features of the resulting actor using an HttpRequestSenderConfig object. A concrete implementation of this trait must evaluate the configuration and construct an actor that supports all the features requested. This not only simplifies client code but also increases testability, as mock implementations of this trait can be used.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def createMultiHostRequestSender(spawner: Spawner, config: HttpRequestSenderConfig, requestActorFactory: RequestActorFactory): ActorRef[HttpCommand]

Creates a new actor instance for sending HTTP requests to different hosts that satisfies the criteria defined by the given configuration. Note that the resulting actor is fully initialized; it is not necessary to call ''decorateRequestSender()'' manually.

Creates a new actor instance for sending HTTP requests to different hosts that satisfies the criteria defined by the given configuration. Note that the resulting actor is fully initialized; it is not necessary to call ''decorateRequestSender()'' manually.

Value parameters

config

the configuration of the request sender actor

requestActorFactory

a factory for creating new host-specific request sender actors

spawner

the object to create new actor instances

Attributes

Returns

a reference to the newly created actor

def createRequestSender(spawner: Spawner, baseUri: Uri, config: HttpRequestSenderConfig): ActorRef[HttpCommand]

Creates a new actor instance for sending HTTP requests to the specified URI that satisfies the criteria defined by the given configuration. Note that the resulting actor is fully initialized; it is not necessary to call ''decorateRequestSender()'' manually.

Creates a new actor instance for sending HTTP requests to the specified URI that satisfies the criteria defined by the given configuration. Note that the resulting actor is fully initialized; it is not necessary to call ''decorateRequestSender()'' manually.

Value parameters

baseUri

the URI of the host supported by the new actor

config

the configuration of the request sender actor

spawner

the object to create new actor instances

Attributes

Returns

a reference to the newly created actor

def decorateRequestSender(spawner: Spawner, requestSender: ActorRef[HttpCommand], config: HttpRequestSenderConfig): ActorRef[HttpCommand]

Decorates the given actor for sending HTTP requests to support all the features declared by the passed in configuration. Adding features to the given actor typically requires the creation of new actors that wrap the original one. The function returns an ''ActorRef'' that has been configured with all desired properties. This function can be used by clients that already have a basic HTTP sender actor and want to enhance it.

Decorates the given actor for sending HTTP requests to support all the features declared by the passed in configuration. Adding features to the given actor typically requires the creation of new actors that wrap the original one. The function returns an ''ActorRef'' that has been configured with all desired properties. This function can be used by clients that already have a basic HTTP sender actor and want to enhance it.

Value parameters

config

the configuration of the request sender actor

requestSender

the original request sender actor to be extended

spawner

the object to create new actor instances

Attributes

Returns

a reference to the decorated actor