Giter Club home page Giter Club logo

example-apps's Introduction

karafka logo

Build Status Gem Version Join the chat at https://slack.karafka.io

About Karafka

Karafka is a Ruby and Rails multi-threaded efficient Kafka processing framework that:

# Define what topics you want to consume with which consumers in karafka.rb
Karafka::App.routes.draw do
  topic 'system_events' do
    consumer EventsConsumer
  end
end

# And create your consumers, within which your messages will be processed
class EventsConsumer < ApplicationConsumer
  # Example that utilizes ActiveRecord#insert_all and Karafka batch processing
  def consume
    # Store all of the incoming Kafka events locally in an efficient way
    Event.insert_all messages.payloads
  end
end

Karafka uses threads to handle many messages simultaneously in the same process. It does not require Rails but will integrate tightly with any Ruby on Rails applications to make event processing dead simple.

Getting started

karafka web ui

If you're entirely new to the subject, you can start with our "Kafka on Rails" articles series, which will get you up and running with the terminology and basic ideas behind using Kafka:

If you want to get started with Kafka and Karafka as fast as possible, then the best idea is to visit our Getting started guides and the example apps repository.

We also maintain many integration specs illustrating various use-cases and features of the framework.

TL;DR (1 minute from setup to publishing and consuming messages)

Prerequisites: Kafka running. You can start it by following instructions from here.

  1. Add and install Karafka:
# Make sure to install Karafka 2.4
bundle add karafka --version ">= 2.4.0"

bundle exec karafka install
  1. Dispatch a message to the example topic using the Rails or Ruby console:
Karafka.producer.produce_sync(topic: 'example', payload: { 'ping' => 'pong' }.to_json)
  1. Run Karafka server and see the consumption magic happen:
bundle exec karafka server

[86d47f0b92f7] Polled 1 message in 1000ms
[3732873c8a74] Consume job for ExampleConsumer on example started
{"ping"=>"pong"}
[3732873c8a74] Consume job for ExampleConsumer on example finished in 0ms

Want to Upgrade? LGPL is not for you? Want to help?

I also sell Karafka Pro subscriptions. It includes a commercial-friendly license, priority support, architecture consultations, enhanced Web UI and high throughput data processing-related features (virtual partitions, long-running jobs, and more).

10% of the income will be distributed back to other OSS projects that Karafka uses under the hood.

Help me provide high-quality open-source software. Please see the Karafka homepage for more details.

Support

Karafka has Wiki pages for almost everything and a pretty decent FAQ. It covers the installation, setup, and deployment, along with other useful details on how to run Karafka.

If you have questions about using Karafka, feel free to join our Slack channel.

Karafka has priority support for technical and architectural questions that is part of the Karafka Pro subscription.

example-apps's People

Contributors

agwozdowski avatar cxk280 avatar dependabot[bot] avatar dominh avatar gustavocaso avatar marysieek avatar mensfeld avatar nijikon avatar olleolleolle avatar pavlo-vavruk avatar renovate[bot] avatar whithajess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

example-apps's Issues

How do you configure redis server?

How do you specify IP and namespace of redis server?
karafka-sidekiq-backend seems to look for 127.0.0.1:6379 by default.

Adding sidekiq.rb to config/initializers

Sidekiq.configure_server do |config|
    config.redis = { url: 'redis://192.168.99.100:6379', namespace: "sidekiq" }
end

Sidekiq.configure_client do |config|
    config.redis = { url: 'redis://192.168.99.100:6379', namespace: "sidekiq" }
end

does not seem to work.

Upgrade to 0.6

Would be awesome if we would have some cool stuff in the example app:

  • Few customer groups with few topics
  • Some inline processing
  • Some sidekiq processing
  • Batch processing
  • And something without batch processing

Provide docker-compose to run ALL of the things together as an example

FROM ruby:3.2

RUN export DEBIAN_FRONTEND=noninteractive && \
  apt-get -y update && \
  apt-get -y upgrade && \
  apt-get install -y --no-install-recommends libsnappy-dev libjemalloc2 && \
  gem update --system && \
  bundle config --local silence_root_warning 1 && \
  bundle config --local github.https true && \
  bundle install

WORKDIR /app
COPY . /app

Cannot connect to cluster when running `bundle exec karakfa s`

I'm trying to run the example app in conjunction with running a Kafka server using Apache's Quick Start instructions. However, when I try to do so, Karafka cannot connect to the cluster.

It returns the errors INFO -- : Fetching cluster metadata from kafka://172.17.0.3:9092 and ERROR -- : Timed out while trying to connect to 172.17.0.3:9092: Operation timed out. I'm running Zookeeper and Kafka according to the Quick Start instructions, and I also tried starting new nodes, but it still didn't work. I can send and receive messages to myself on the Kafka side, so that seems to be working.

I suspect there's an issue with matching the ports, but I'm not entirely sure how to properly resolve this. Please help.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bundler
v2.4-non-rails/Gemfile
  • activesupport undefined
  • rake undefined
  • rexml undefined
  • karafka undefined
  • byebug undefined
  • karafka-testing undefined
  • rspec undefined
  • simplecov undefined
v2.4-rails/Gemfile
  • karafka undefined
  • karafka-web undefined
  • puma undefined
  • rails '~> 7.1'
  • sqlite3 '1.7.3'
  • karafka-testing undefined
  • rspec undefined
docker-compose
docker-compose.yml
  • confluentinc/cp-kafka 7.6.1
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/checkout v4
  • ruby/setup-ruby v1
  • actions/checkout v4
  • actions/checkout v4
  • ruby/setup-ruby v1
ruby-version
v2.4-non-rails/.ruby-version
  • ruby 3.3.3
v2.4-rails/.ruby-version
  • ruby 3.3.3

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.