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.Consumer

Contents

Description

 

Synopsis

The Consumer

data KinesisConsumer Source

The KinesisConsumer maintains state about which shards to pull from.

managedKinesisConsumer :: MonadConsumer m => ConsumerKit -> Codensity m KinesisConsumer Source

This constructs a KinesisConsumer and closes it when you have done with it; this is equivalent to withKinesisConsumer, except that the continuation is replaced with returning the consumer in Codensity.

withKinesisConsumer :: MonadConsumer m => ConsumerKit -> (KinesisConsumer -> m α) -> m α Source

This constructs a KinesisConsumer and closes it when you have done with it.

Commands

consumerSource :: MonadConsumer m => KinesisConsumer -> Source m Record Source

A conduit for getting records.

readConsumer :: MonadConsumer m => KinesisConsumer -> m Record Source

Await and read a single record from the consumer.

tryReadConsumer :: MonadConsumer m => KinesisConsumer -> m (Maybe Record) Source

Try to read a single record from the consumer; if there is non queued up, then Nothing will be returned.

consumerStreamState :: MonadConsumer m => KinesisConsumer -> m SavedStreamState Source

Get the last read sequence number at each shard.

Consumer Environment

data ConsumerKit Source

The ConsumerKit contains what is needed to initialize a KinesisConsumer.

Constructors

ConsumerKit 

Fields

_ckKinesisKit :: !KinesisKit

The credentials and configuration for making requests to AWS Kinesis.

_ckStreamName :: !StreamName

The name of the stream to consume from.

_ckBatchSize :: !Int

The number of records to fetch at once from the stream.

_ckIteratorType :: !ShardIteratorType

The type of iterator to consume.

_ckSavedStreamState :: !(Maybe SavedStreamState)

Optionally, an initial stream state. The iterator type in _ckIteratorType will be used for any shards not present in the saved stream state; otherwise, AfterSequenceNumber will be used.

data ConsumerError Source

Constructors

NoShards

A stream must always have at least one open shard.

KinesisError !SomeException

An error which derives from a request made to Kinesis.

Instances

type MonadConsumer m = (MonadIO m, MonadBaseControl IO m, MonadError ConsumerError m) Source

The basic effect modality required for operating the consumer.