Copyright | 2019 Daniel YU |
---|---|
License | MIT |
Maintainer | leptonyu@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
A quick out-of-box factory using to build microservices with many useful builtin components based on boots-web.
Synopsis
- buildConsul :: (MonadMask n, MonadIO n, HasSalak env, HasApp env, HasLogger env) => Factory n (WebEnv env context) ()
- data ManagerSettings
- data Manager
- newManager :: ManagerSettings -> IO Manager
- managerConnCount :: ManagerSettings -> Int
- managerRawConnection :: ManagerSettings -> IO (Maybe HostAddress -> String -> Int -> IO Connection)
- managerTlsConnection :: ManagerSettings -> IO (Maybe HostAddress -> String -> Int -> IO Connection)
- managerResponseTimeout :: ManagerSettings -> ResponseTimeout
- managerRetryableException :: ManagerSettings -> SomeException -> Bool
- managerWrapException :: ManagerSettings -> forall a. Request -> IO a -> IO a
- managerIdleConnectionCount :: ManagerSettings -> Int
- managerModifyRequest :: ManagerSettings -> Request -> IO Request
- managerModifyResponse :: ManagerSettings -> Response BodyReader -> IO (Response BodyReader)
- managerLogException :: HasLogger env => env -> ManagerSettings -> ManagerSettings
Service management
buildConsul :: (MonadMask n, MonadIO n, HasSalak env, HasApp env, HasLogger env) => Factory n (WebEnv env context) () Source #
Register consule service.
Client
data ManagerSettings #
Settings for a Manager
. Please use the defaultManagerSettings
function and then modify
individual settings. For more information, see http://www.yesodweb.com/book/settings-types.
Since 0.1.0
Instances
Default ManagerSettings Source # | |
Defined in Boots.Factory.Client def :: ManagerSettings # | |
FromProp m ManagerSettings Source # | |
Defined in Boots.Factory.Client fromProp :: Prop m ManagerSettings # |
Keeps track of open connections for keep-alive.
If possible, you should share a single Manager
between multiple threads and requests.
Since 0.1.0
Instances
HasHttpManager Manager | |
Defined in Network.HTTP.Client.Types getHttpManager :: Manager -> Manager # |
newManager :: ManagerSettings -> IO Manager #
Create a Manager
. The Manager
will be shut down automatically via
garbage collection.
Creating a new Manager
is a relatively expensive operation, you are
advised to share a single Manager
between requests instead.
The first argument to this function is often defaultManagerSettings
,
though add-on libraries may provide a recommended replacement.
Since 0.1.0
managerConnCount :: ManagerSettings -> Int #
Number of connections to a single host to keep alive. Default: 10.
Since 0.1.0
managerRawConnection :: ManagerSettings -> IO (Maybe HostAddress -> String -> Int -> IO Connection) #
Create an insecure connection.
Since 0.1.0
managerTlsConnection :: ManagerSettings -> IO (Maybe HostAddress -> String -> Int -> IO Connection) #
Create a TLS connection. Default behavior: throw an exception that TLS is not supported.
Since 0.1.0
managerResponseTimeout :: ManagerSettings -> ResponseTimeout #
Default timeout to be applied to requests which do not provide a timeout value.
Default is 30 seconds
Since: http-client-0.5.0
managerRetryableException :: ManagerSettings -> SomeException -> Bool #
Exceptions for which we should retry our request if we were reusing an already open connection. In the case of IOExceptions, for example, we assume that the connection was closed on the server and therefore open a new one.
Since 0.1.0
managerWrapException :: ManagerSettings -> forall a. Request -> IO a -> IO a #
Action wrapped around all attempted Request
s, usually used to wrap
up exceptions in library-specific types.
Default: wrap all IOException
s in the InternalException
constructor.
Since: http-client-0.5.0
managerIdleConnectionCount :: ManagerSettings -> Int #
Total number of idle connection to keep open at a given time.
This limit helps deal with the case where you are making a large number of connections to different hosts. Without this limit, you could run out of file descriptors. Additionally, it can be set to zero to prevent reuse of any connections. Doing this is useful when the server your application is talking to sits behind a load balancer.
Default: 512
Since 0.3.7
managerModifyRequest :: ManagerSettings -> Request -> IO Request #
Perform the given modification to a Request
before performing it.
Default: no modification
Since 0.4.4
managerModifyResponse :: ManagerSettings -> Response BodyReader -> IO (Response BodyReader) #
Perform the given modification to a Response
after receiving it.
Default: no modification
Since: http-client-0.5.5
managerLogException :: HasLogger env => env -> ManagerSettings -> ManagerSettings Source #