Feral

AWS offers the ability to consume Kinesis events via an AWS Lambda.

kinesis4cats offers an KinesisStreamEvent that maps to the event structure received in the lambda. This can be used in a Feral instance.

Feral does offer a similar event, in which you can see an example usage here. However, one common problem that users have with Kinesis Lambda functions is that they do not perform record deaggregation. kinesis4cats offers a deaggregate function in its KinesisStreamEvent class, which users can leverage to resolve this problem.

Installation

libraryDependencies += "io.github.etspaceman" %% "kinesis4cats-feral" % "0.0.32"

Usage

import cats.effect._
import feral.lambda._

import kinesis4cats.consumer.feral.KinesisStreamEvent

object kinesisHandler extends IOLambda.Simple[KinesisStreamEvent, INothing] {
  type Init
  def apply(event: KinesisStreamEvent, context: Context[IO], init: Init) = for {
    records <- IO.fromTry(event.deaggregate)
    _ <- IO.println(s"Received event with ${records.size} records").as(None)
  } yield None
}