Copyright | Copyright © 2013-2014 PivotCloud, Inc. |
---|---|
License | Apache-2.0 |
Maintainer | Jon Sterling <jsterling@alephcloud.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
- data KinesisProducer
- withKinesisProducer :: (MonadIO m, MonadBaseControl IO m, MonadError ProducerError m) => ProducerKit -> (KinesisProducer -> m α) -> m α
- managedKinesisProducer :: forall m. (MonadIO m, MonadBaseControl IO m, MonadError ProducerError m) => ProducerKit -> Codensity m KinesisProducer
- writeProducer :: MonadProducer m => KinesisProducer -> Message -> m ()
- type Message = Text
- type MonadProducer m = (MonadIO m, MonadBaseControl IO m, MonadError ProducerError m)
- data ProducerKit = ProducerKit {}
- pkKinesisKit :: Lens' ProducerKit KinesisKit
- pkStreamName :: Lens' ProducerKit StreamName
- pkBatchPolicy :: Lens' ProducerKit BatchPolicy
- pkRetryPolicy :: Lens' ProducerKit RetryPolicy
- pkMessageQueueBounds :: Lens' ProducerKit Int
- pkMaxConcurrency :: Lens' ProducerKit Int
- data ProducerError
- _KinesisError :: Prism' ProducerError SomeException
- _MessageNotEnqueued :: Prism' ProducerError Message
- _InvalidConcurrentConsumerCount :: Prism' ProducerError ()
- _MessageTooLarge :: Prism' ProducerError ()
- MaxMessageSize
- data BatchPolicy
- defaultBatchPolicy :: BatchPolicy
- bpBatchSize :: Lens' BatchPolicy Int
- bpEndpoint :: Lens' BatchPolicy RecordEndpoint
- data RetryPolicy
- defaultRetryPolicy :: RetryPolicy
- rpRetryCount :: Lens' RetryPolicy Int
- data RecordEndpoint
The Producer
data KinesisProducer Source
The (abstract) Kinesis producer client.
withKinesisProducer :: (MonadIO m, MonadBaseControl IO m, MonadError ProducerError m) => ProducerKit -> (KinesisProducer -> m α) -> m α Source
This constructs a KinesisProducer
and closes it when you have done with
it.
managedKinesisProducer :: forall m. (MonadIO m, MonadBaseControl IO m, MonadError ProducerError m) => ProducerKit -> Codensity m KinesisProducer Source
This constructs a KinesisProducer
and closes it when you have done with
it. This is equivalent to withKinesisProducer
, but replaces the
continuation with a return in Codensity
.
Commands
writeProducer :: MonadProducer m => KinesisProducer -> Message -> m () Source
Enqueues a message to Kinesis on the next shard. If a message cannot be
enqueued (because the client has exceeded its queue size), the
MessageNotEnqueued
exception will be thrown.
Producer Environment
type MonadProducer m = (MonadIO m, MonadBaseControl IO m, MonadError ProducerError m) Source
The basic effect modality required to use the Kinesis producer.
data ProducerKit Source
The basic input required to construct a Kinesis producer.
ProducerKit | |
|
pkKinesisKit :: Lens' ProducerKit KinesisKit Source
A lens for _pkKinesisKit
.
pkStreamName :: Lens' ProducerKit StreamName Source
A lens for _pkStreamName
.
pkBatchPolicy :: Lens' ProducerKit BatchPolicy Source
A lens for _pkBatchPolicy
.
pkRetryPolicy :: Lens' ProducerKit RetryPolicy Source
A lens for _pkRetryPolicy
.
pkMessageQueueBounds :: Lens' ProducerKit Int Source
A lens for _pkMessageQueueBounds
.
pkMaxConcurrency :: Lens' ProducerKit Int Source
A lens for _pkMaxConcurrency
.
data ProducerError Source
KinesisError !SomeException | Represents an error which occured as a result of a request to Kinesis. |
MessageNotEnqueued Message | Thrown when a message could not be enqueued since the queue was full. This error must be handled at the call-site. |
MessageTooLarge | Thrown when the message was larger than the maximum message size ( |
InvalidConcurrentConsumerCount | Thrown when |
_KinesisError :: Prism' ProducerError SomeException Source
A prism for KinesisError
.
_MessageNotEnqueued :: Prism' ProducerError Message Source
A prism for MessageNotEnqueued
.
_InvalidConcurrentConsumerCount :: Prism' ProducerError () Source
A prism for InvalidConcurrentConsumerCount
.
_MessageTooLarge :: Prism' ProducerError () Source
A prism for MessageTooLarge
.
MaxMessageSize
data BatchPolicy Source
The producer batches records according to a user-specified policy.
defaultBatchPolicy :: BatchPolicy Source
The default batching policy sends 200
records per PutRecordsEndpoint
request.
bpBatchSize :: Lens' BatchPolicy Int Source
The number of records to send in a single request. This is only used
when the endpoint is set to PutRecordsEndpoint
.
bpEndpoint :: Lens' BatchPolicy RecordEndpoint Source
The endpoint to use when sending records to Kinesis.
data RetryPolicy Source
The producer will attempt to re-send records which failed according to a user-specified policy. This policy applies to failures which occur in the process of sending a message to Kinesis, not those which occur in the course of enqueuing a message.
defaultRetryPolicy :: RetryPolicy Source
The default retry policy will attempt 5
retries for a message.
rpRetryCount :: Lens' RetryPolicy Int Source
The number of times to retry sending a message after it has first failed.
data RecordEndpoint Source
There are two endpoints which may be used to send records to Kinesis.
PutRecordEndpoint | Use the |
PutRecordsEndpoint | Use the |