Skip to content

Integrating with Ruby on Rails and other frameworks

Want to use Karafka with Ruby on Rails or any other framework? It can be done easily!

Integrating with Ruby on Rails

Karafka detects Ruby on Rails by itself, so no extra changes are required besides running the standard installation process.

Add Karafka to your Gemfile:

bundle add karafka

and run the installation command:

bundle exec karafka install

It will create all the needed directories and files and the karafka.rb configuration file. After that, you should be good to go.

We also have an example Ruby on Rails application that illustrates integration with this framework.

Integrating with Sinatra and other frameworks

Non-Rails applications differ from one another. There are single-file applications and apps similar to the Rails structure. That's why we cannot provide a simple single tutorial. Here are some guidelines that you should follow to integrate it with Sinatra based application:

Add Karafka to your application Gemfile:

gem 'karafka'

run the installation process:

bundle exec karafka install

After that, ensure that your application is loaded before setting up and booting Karafka.