Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Lua
  3. lua-resty-kafka

lua-resty-kafka

BSD-3-ClauseLua

A Lua Kafka client driver for OpenResty/ngx_lua using the cosocket API for non-blocking communication.

GitHubGitHub
813 stars286 forks0 contributors

What is lua-resty-kafka?

lua-resty-kafka is a Lua library that provides a client driver for Apache Kafka, specifically designed for use with OpenResty and the ngx_lua module. It enables Lua applications running within Nginx to produce and consume messages from Kafka topics using a non-blocking, event-driven approach. The library solves the problem of integrating Kafka with high-performance web servers without sacrificing concurrency or responsiveness.

Target Audience

Developers building real-time data processing pipelines, log aggregation systems, or microservices with OpenResty who need to interact with Kafka clusters efficiently. It's particularly suited for those already using ngx_lua for other non-blocking operations.

Value Proposition

Developers choose lua-resty-kafka because it leverages OpenResty's cosocket API for truly non-blocking network operations, avoiding the performance pitfalls of blocking I/O in Lua. Its tight integration with the Nginx ecosystem makes it a natural choice for existing OpenResty deployments over generic Kafka clients.

Overview

Lua kafka client driver for the Openresty based on the cosocket API

Use Cases

Best For

  • Sending application logs from Nginx to Kafka for centralized logging
  • Building real-time event-driven microservices with OpenResty
  • Implementing non-blocking message producers in Lua within Nginx
  • Creating lightweight Kafka consumers for simple data fetching tasks
  • Integrating Kafka with existing OpenResty APIs for stream processing
  • Developing high-throughput data pipelines that require SSL/SASL authentication

Not Ideal For

  • Applications requiring Kafka consumer groups for coordinated message consumption, as it only has a basic consumer without group support.
  • Projects not using OpenResty or LuaJIT, since it's tightly coupled to these technologies and requires specific Nginx modules.
  • High-throughput consumer scenarios needing batch fetching or advanced Kafka features like compression, which are unsupported.
  • Production systems demanding stable, fully-featured libraries, given its experimental status and early development stage.

Pros & Cons

Pros

Non-blocking Architecture

Uses ngx_lua's cosocket API for 100% non-blocking operations, ensuring high performance in event-driven Nginx environments without blocking workers.

Secure Authentication Support

Supports SSL and multiple SASL mechanisms like PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512, enabling secure connections to Kafka clusters with optional dependencies.

Asynchronous Producer

Offers an async producer with configurable buffering, retry logic, and error handling, allowing for efficient message batching and improved throughput.

Metadata Management

Provides methods to fetch and refresh Kafka cluster metadata, including broker and partition information, aiding in dynamic topic handling.

Cons

Limited Consumer Features

The basic consumer lacks support for consumer groups and batch fetching, making it unsuitable for distributed consumption patterns or high-performance fetching needs.

Missing Compression Support

Explicitly does not support compression, which can impact performance and bandwidth usage in high-volume data streaming scenarios.

Experimental and Version-Dependent

Still under early development with experimental status, and requires specific ngx_lua or OpenResty versions, potentially leading to instability or compatibility issues.

Frequently Asked Questions

Quick Stats

Stars813
Forks286
Contributors0
Open Issues77
Last commit2 years ago
CreatedSince 2014

Tags

#stream-processing#message-queue#non-blocking#nginx-lua#real-time-data#microservices#cosocket#apache-kafka#openresty

Built With

n
ngx_lua
L
LuaJIT
O
OpenResty
L
Lua

Included in

Lua4.5k
Auto-fetched 5 hours ago

Related Projects

lua-resty-rabbitmqstomplua-resty-rabbitmqstomp

Opinionated Lua RabbitMQ client library for the ngx_lua apps based on the cosocket API

Stars194
Forks55
Last commit6 years ago
lua-zmqlua-zmq

Lua zeromq2 binding

Stars158
Forks37
Last commit1 year ago
lzmqlzmq

Lua binding to ZeroMQ

Stars145
Forks43
Last commit6 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub