Address

Class addresses (Actor.Class)

data Address a

tell      :: Address a -> Message a -> ()
ask       :: Address a -> (Reply r -> Message a) -> Either Fault r
askWithin :: Int -> Address a -> (Reply r -> Message a) -> Either Fault r
refOf     :: Address a -> ActorRef (Message a)

Answers (Actor.Address)

Function Type Meaning
respond Reply r -> r -> () Answer an ask
refuse Reply r -> Fault -> () Answer an ask with a failure

Engine references (Actor.Address)

ActorRef msg is the reference under a class’s address, and what spawnActor returns.

Function Type Meaning
tellRef ActorRef msg -> msg -> () Tell; a dead letter if it stopped
askRef ActorRef msg -> (Reply r -> msg) -> Either Fault r Ask; ActorStopped at once if it stopped
askRefWithin Int -> ActorRef msg -> (Reply r -> msg) -> Either Fault r Ask with a timeout (Timeout)
routeOf ActorRef msg -> String Its route, as /user/account/alice
pidOf ActorRef msg -> Int Its id
running ActorRef msg -> Bool Whether it still runs

Routes (Actor.Route)

Function Type Meaning
routeTemplate String -> RouteTemplate Parse "account/{id}"
isParameterized RouteTemplate -> Bool Whether it has parameters
parameterNames RouteTemplate -> [String] Its parameters, lowercased
resolveRoute RouteTemplate -> Parameters -> Either Fault String Fill it; Left if one is missing
parametersFrom [(String, String)] -> Parameters Make parameters
withParameter String -> String -> Parameters -> Parameters Set one
parameterValue String -> Parameters -> Maybe String Read one

Across a cluster (Surround.Host)

Function Type
askRoute ActorClient -> String -> String -> Bytes -> Int -> Either Fault Bytes
tellRoute ActorClient -> String -> String -> Bytes -> ()

The arguments are the route, the payload’s type name, the payload and (for an ask) the timeout.

Circuit breaker (Actor.Breaker)

Function Type Meaning
breaker Int -> Int -> Breaker Opens after n failures in a row; tries again after ms
call Int -> Breaker -> (() -> Either Fault a) -> Called a A call at a time; refused while open
calledBreaker Called a -> Breaker The breaker after the call
calledResult Called a -> Either Fault a The call’s result
phaseAt Int -> Breaker -> Phase IsClosed, IsOpen or IsHalfOpen