Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Airbase/eventbusk

Open more actions menu

Repository files navigation

eventbusk - Event Bus Framework

Keywords: event-bus, distributed, stream, processing, data, queue, kafka, python

Install

pip install git+https://github.com/Airbase/eventbusk.git

Quick Start

from eventbusk import Event, EventBus
from dataclasses import dataclass

# create an app instance of the bus
bus = EventBus(broker="kafka://localhost:9092")

# define an event as a dataclass
@dataclass
class Foo(Event):
    foo: int

# register the event to a single topic
bus.register_event("topic_foo", Foo)

# Define an method that receives that event
@bus.receive(event_type=Foo)
def process_a(event):
    logger.info(f"Foo: {event}")


# Publish an event to the bus
foo = Foo(foo=1)
bus.send(foo)

Contributing

Pre-requisites include installing

You can start a Confluent Kafka server locally via docker by following https://docs.confluent.io/platform/current/platform-quickstart.html

Next setup the project locally as follows

git clone git@github.com:Airbase/eventbusk.git
cd eventbusk
pre-commit install
source $(poetry env info -p)/bin/activate
poetry install --no-root
pip install --editable .

Now you can run the example project consumers. Ensure the topics in the example are created first.

cd examples
eventbusk worker -A eventbus:bus

You can also publish

python

>>> from eventbus import bus, Fooey
>>> bus.send(Fooey(foo_val="lorem ipsum"))

About

Event bus with Kafka

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.