aws-kinesis-client-0.3.0.2: A producer & consumer client library for AWS Kinesis

CopyrightCopyright © 2013-2014 PivotCloud, Inc.
LicenseApache-2.0
MaintainerJon Sterling <jsterling@alephcloud.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Aws.Kinesis.Client.Producer

Contents

Description

 

Synopsis

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.

Constructors

ProducerKit 

Fields

_pkKinesisKit :: !KinesisKit

The basic information required to send requests to AWS Kinesis.

_pkStreamName :: !StreamName

The name of the stream to send records to.

_pkBatchPolicy :: !BatchPolicy

The record batching policy for the producer.

_pkRetryPolicy :: !RetryPolicy

The retry policy for the producer.

_pkMessageQueueBounds :: !Int

The maximum number of records that may be enqueued at one time.

_pkMaxConcurrency :: !Int

The number of requests to run concurrently (minimum: 1).

data ProducerError Source

Constructors

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 (MaxMessageSize).

InvalidConcurrentConsumerCount

Thrown when pkMaxConcurrency is set with an invalid value.

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.

Constructors

PutRecordEndpoint

Use the PutRecord endpoint, which sends records one at a time.

PutRecordsEndpoint

Use the PutRecords endpoint, which sends records in batches.