Kafka + AWS lambda

后端 未结 6 1272
夕颜
夕颜 2021-01-31 18:36

Is it possible to integrate AWS Lambda with Apache Kafka ? I want to put a consumer in a lambda function. When a consumer receive a message the lambda function execute.

6条回答
  •  無奈伤痛
    2021-01-31 19:39

    Continuing the point by Arafat. We have successfully built an infrastructure to consume from Kafka using AWS Lambdas. Here are some gotcha's:

    • Make sure to consistently batch and commit while reading when consuming.
    • If you are storing the batches to s3, make sure to clean your file descriptors.
    • If you are forwarding the batches to another service make sure to clean the variables. Variable caching in AWS Lambda might result in memory overflows.
    • A good idea is to check how much time you have left while from the context object in the Lambda and give yourself some wiggle room to do something with the buffer you populated in your consumer which might not be read to a file unless you call close().

    We are using Apache Airflow for scheduling. I hear cloudwatch can do that too.

提交回复
热议问题