Hoogle Search

Within LTS Haskell 24.34 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. type ConsumerTag = Text

    amqp Network.AMQP

    No documentation available.

  2. NoConsumers :: Text -> ReturnReplyCode

    amqp Network.AMQP

    No documentation available.

  3. cancelConsumer :: Channel -> ConsumerTag -> IO ()

    amqp Network.AMQP

    stops a consumer that was started with consumeMsgs

  4. consumeMsgs :: Channel -> Text -> Ack -> ((Message, Envelope) -> IO ()) -> IO ConsumerTag

    amqp Network.AMQP

    consumeMsgs chan queue ack callback subscribes to the given queue and returns a consumerTag. For any incoming message, the callback will be run. If ack == Ack you will have to acknowledge all incoming messages (see ackMsg and ackEnv)

    Exceptions in the callback

    If an exception occurs in callback, it will be caught and printed to stderr. But you should not depend on this behaviour (it might change in future versions of this library); instead, it is strongly recommended that you catch any exceptions that your callback may throw and handle them appropriately. But make sure not to catch ChanThreadKilledException (or re-throw it if you did catch it), since it is used internally by the library to close channels. So unless you are confident that your callback won't throw exceptions, you may want to structure your code like this:
    consumeMsgs chan name Ack $ \(msg, env) -> (do ...)
    `CE.catches`
    [
    -- rethrow this exception, since the AMPQ library uses it internally
    CE.Handler $ \(e::ChanThreadKilledException) -> CE.throwIO e,
    
    -- (optional) catch individual exceptions that your code may throw
    CE.Handler $ \(e::CE.IOException) -> ...,
    CE.Handler $ \(e::SomeOtherException) -> ...,
    
    -- catch all exceptions that weren't handled above
    CE.Handler $ \(e::CE.SomeException) -> ...
    ]
    
    In practice, it might be useful to encapsulate this exception-handling logic in a custom wrapper-function so that you can reuse it for every callback you pass to consumeMsgs.

    Blocking requests in the callback

    The callback will be run on the channel's receiver thread (which is responsible for handling all incoming messages on this channel, including responses to requests from the client) so DO NOT perform any blocking request on chan inside the callback, as this would lead to a dead-lock. However, you CAN perform requests on other open channels inside the callback, though that would keep chan blocked until the requests are done, so it is not recommended. Unless you're using AMQP flow control, the following functions can safely be called on chan: ackMsg, ackEnv, rejectMsg, publishMsg. If you use flow-control or want to perform anything more complex, it's recommended that instead of using consumeMsgs you use getMsg to fetch messages in a loop (because then your message-handling code will not run in the channel's receiver thread, so there will be no problems when performing blocking requests).

  5. consumeMsgs' :: Channel -> Text -> Ack -> ((Message, Envelope) -> IO ()) -> (ConsumerTag -> IO ()) -> FieldTable -> IO ConsumerTag

    amqp Network.AMQP

    an extended version of consumeMsgs that allows you to define a consumer cancellation callback and include arbitrary arguments.

  6. consumeMsgs :: MonadBaseControl IO m => Channel -> Text -> Ack -> ((Message, Envelope) -> m ()) -> m ConsumerTag

    amqp Network.AMQP.Lifted

    Lifted version of consumeMsgs (please look there for documentation). In addition, while the callback function ((Message, Envelope) -> m ()) has access to the captured state, all its side-effects in m are discarded.

  7. consumeMsgs' :: MonadBaseControl IO m => Channel -> Text -> Ack -> ((Message, Envelope) -> m ()) -> (ConsumerTag -> m ()) -> FieldTable -> m ConsumerTag

    amqp Network.AMQP.Lifted

    an extended version of consumeMsgs that allows you to define a consumer cancellation callback and include arbitrary arguments.

  8. type ConsumerTag = Text

    amqp Network.AMQP.Types

    No documentation available.

  9. totientSum :: forall t (v :: Type -> Type) . (Integral t, Vector v t) => Proxy v -> Word -> t

    arithmoi Math.NumberTheory.MoebiusInversion

    totientSum n is, for n > 0, the sum of [totient k | k <- [1 .. n]], computed via generalised Möbius inversion. See http://mathworld.wolfram.com/TotientSummatoryFunction.html for the formula used for totientSum.

    >>> import Data.Proxy
    
    >>> totientSum (Proxy :: Proxy Data.Vector.Unboxed.Vector) 100 :: Int
    3044
    
    >>> totientSum (Proxy :: Proxy Data.Vector.Vector) 100 :: Integer
    3044
    

  10. consumeN :: Int64 -> (a -> (a, b)) -> a -> (a, [b])

    avro Data.Avro.Internal.Container

    No documentation available.

Page 160 of many | Previous | Next