Ruby gem: rdkafka
gem install rdkafka -v 0.21.1.alpha2 gem 'rdkafka', '~> 0.21.1.alpha2' Gem::Specification.new do |spec|
spec.name = "rdkafka"
spec.version = "0.21.1.alpha2"
spec.authors = ["Thijs Cadier","Maciej Mensfeld"]
spec.license = "MIT"
spec.summary = "The rdkafka gem is a modern Kafka client library for Ruby based on librdkafka. It wraps the production-ready C client using the ffi gem and targets Kafka 1.0+ and Ruby 2.7+."
spec.description = "Modern Kafka client library for Ruby based on librdkafka"
spec.homepage = "https://karafka.io"
spec.required_ruby_version = ">= 3.1"
spec.metadata = {
"funding_uri" => "https://karafka.io/#become-pro",
"homepage_uri" => "https://karafka.io",
"changelog_uri" => "https://karafka.io/docs/Changelog-Rdkafka",
"bug_tracker_uri" => "https://github.com/karafka/rdkafka-ruby/issues",
"source_code_uri" => "https://github.com/karafka/rdkafka-ruby",
"documentation_uri" => "https://karafka.io/docs",
"rubygems_mfa_required" => "true",
}
spec.add_dependency "ffi", "~> 1.15"
spec.add_dependency "mini_portile2", "~> 2.6"
spec.add_dependency "rake", "> 12"
spec.add_development_dependency "guard", ">= 0"
spec.add_development_dependency "guard-rspec", ">= 0"
spec.add_development_dependency "pry", ">= 0"
spec.add_development_dependency "rake", ">= 0"
spec.add_development_dependency "rspec", "~> 3.5"
spec.add_development_dependency "simplecov", ">= 0"
end To lock this gem at this specific version, update your Gemfile:
gem 'rdkafka', '0.21.1.alpha2' Then run:
bundle install Note: This is an older version. Consider upgrading to the latest version (0.24.2) for the newest features and security fixes.
Run this to see all installed versions of rdkafka:
gem list rdkafka --exact To check for this exact version and get a true/false exit code (useful in scripts):
gem list rdkafka -i -v 0.21.1.alpha2 Exits 0 if installed, 1 if not.
To remove this specific version:
gem uninstall rdkafka -v 0.21.1.alpha2 To remove all installed versions at once:
gem uninstall rdkafka --all
If another gem depends on this version, RubyGems will warn you. Add --force to bypass the warning, but check nothing still needs it first.
If the gem is already installed, unpack its source into the current directory:
gem unpack rdkafka -v 0.21.1.alpha2 If it is not installed, fetch it first and then unpack the file:
gem fetch rdkafka -v 0.21.1.alpha2
gem unpack rdkafka-0.21.1.alpha2.gem
This creates a rdkafka-0.21.1.alpha2/ directory with the full source tree.
Use gem fetch to download the .gem file to the current directory:
gem fetch rdkafka -v 0.21.1.alpha2 Useful for auditing, offline installs, or mirroring to a private gem server.
If the gem is installed:
gem specification rdkafka -v 0.21.1.alpha2 From a downloaded .gem file:
gem fetch rdkafka -v 0.21.1.alpha2
gem specification rdkafka-0.21.1.alpha2.gem Version 0.21.1.alpha2 requires Ruby >= 3.1.
Check your Ruby version with ruby -v.
Runtime dependencies — installed automatically with the gem:
Development dependencies — only needed when working on the gem itself:
To see the full resolved dependency tree after installation: gem dependency rdkafka -v 0.21.1.alpha2
If the gem provides an executable, use the _version_ wrapper syntax:
rdkafka _0.21.1.alpha2_ [args] In a Bundler project, pin the version in your Gemfile and run via bundle exec:
# Gemfile
gem 'rdkafka', '0.21.1.alpha2' bundle exec ruby your_script.rb FROM alpine:latest # Install Ruby and build tools RUN apk add --no-cache ruby ruby-dev build-base # Note: The following dependencies do not have package lists for alpine: # - librdkafka (canonical: librdkafka) # Install the gem RUN gem install rdkafka -v 0.21.1.alpha2 # Verify installation RUN ruby -e "require 'rdkafka'; puts 'Successfully loaded rdkafka'"
FROM archlinux:latest # Install Ruby and build tools RUN pacman -Sy --noconfirm ruby base-devel # Note: The following dependencies do not have package lists for arch: # - librdkafka (canonical: librdkafka) # Install the gem RUN gem install rdkafka -v 0.21.1.alpha2 # Verify installation RUN ruby -e "require 'rdkafka'; puts 'Successfully loaded rdkafka'"
FROM debian:bookworm-slim # Install Ruby and build tools RUN apt-get update -qq && apt-get install -y --no-install-recommends ruby ruby-dev build-essential # Note: The following dependencies do not have package lists for debian: # - librdkafka (canonical: librdkafka) # Install the gem RUN gem install rdkafka -v 0.21.1.alpha2 # Verify installation RUN ruby -e "require 'rdkafka'; puts 'Successfully loaded rdkafka'"
FROM fedora:latest # Install Ruby and build tools RUN dnf install -y ruby ruby-devel gcc gcc-c++ make # Note: The following dependencies do not have package lists for fedora: # - librdkafka (canonical: librdkafka) # Install the gem RUN gem install rdkafka -v 0.21.1.alpha2 # Verify installation RUN ruby -e "require 'rdkafka'; puts 'Successfully loaded rdkafka'"
FROM ubuntu:24.04 # Install Ruby and build tools RUN apt-get update -qq && apt-get install -y --no-install-recommends ruby ruby-dev build-essential # Note: The following dependencies do not have package lists for ubuntu: # - librdkafka (canonical: librdkafka) # Install the gem RUN gem install rdkafka -v 0.21.1.alpha2 # Verify installation RUN ruby -e "require 'rdkafka'; puts 'Successfully loaded rdkafka'"
Deploy with Nixpacks (Railway, Render, etc.)
# nixpacks.toml for rdkafka 0.21.1.alpha2 [phases.setup] # Note: The following dependencies do not have package lists for debian: # - librdkafka (canonical: librdkafka) [phases.install] cmds = ["gem install rdkafka -v 0.21.1.alpha2"] [phases.build] cmds = ["ruby -e \"require 'rdkafka'; puts 'Successfully loaded rdkafka'\""]
Save this as nixpacks.toml in your project root.
Deploy with Cloud Native Buildpacks (Heroku, Paketo, etc.)
# package.toml for rdkafka 0.21.1.alpha2 # Cloud Native Buildpacks configuration # Note: The following dependencies do not have package lists for debian: # - librdkafka (canonical: librdkafka) # Gem installation will be handled by the Ruby buildpack # which automatically installs gems from Gemfile or bundler
Save this as package.toml in your project root.
Develop with Nix using ruby-nixpkgs
# shell.nix for rdkafka 0.21.1.alpha2
# Usage: nix-shell
# Uses ruby-nixpkgs for gem management
{ pkgs ? import <nixpkgs> {} }:
let
rubyVersion = pkgs.ruby_3_3;
# Ruby environment with ruby-nixpkgs
rubyEnv = pkgs.bundlerEnv {
name = "rdkafka-0.21.1.alpha2";
ruby = rubyVersion;
gemdir = ./.;
};
in
pkgs.mkShell {
buildInputs = [
rubyVersion
pkgs.bundler
pkgs.ruby-nixpkgs
# Note: The following dependencies do not have package lists for nixpkgs:
# - librdkafka (canonical: librdkafka)
];
shellHook = ''
echo "Ruby environment for rdkafka 0.21.1.alpha2"
echo "Use: gem install rdkafka -v 0.21.1.alpha2"
'';
}
Save this as shell.nix in your project root, then run nix-shell.
Develop with Devenv for declarative development environments
# devenv.nix for rdkafka 0.21.1.alpha2
# Usage: devenv shell
{ pkgs, lib, config, ... }:
{
languages.ruby = {
enable = true;
version = "3.3.0";
};
packages = [
# Note: The following dependencies do not have package lists for nixpkgs:
# - librdkafka (canonical: librdkafka)
];
enterShell = ''
echo "Development environment for rdkafka 0.21.1.alpha2"
echo "Use: gem install rdkafka -v 0.21.1.alpha2"
'';
}
Save this as devenv.nix in your project root, then run devenv shell.
Develop with Nix Flakes for reproducible development environments
# flake.nix for rdkafka 0.21.1.alpha2
# Usage: nix develop
{
description = "Development environment for rdkafka 0.21.1.alpha2";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
rubyVersion = pkgs.ruby_3_3;
in
{
devShells.default = pkgs.mkShell {
buildInputs = [
rubyVersion
pkgs.bundler
# Note: The following dependencies do not have package lists for nixpkgs:
# - librdkafka (canonical: librdkafka)
];
shellHook = ''
echo "Development environment for rdkafka 0.21.1.alpha2"
echo "Use: gem install rdkafka -v 0.21.1.alpha2"
'';
};
}
);
}
Save this as flake.nix in your project root, then run nix develop.