Coder Social home page Coder Social logo

airtai / fastkafka Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 2.0 7.67 MB

FastKafka is a powerful and easy-to-use Python library for building asynchronous web services that interact with Kafka topics. Built on top of Pydantic, AIOKafka and AsyncAPI, FastKafka simplifies the process of writing producers and consumers for Kafka topics.

Home Page: https://fastkafka.airt.ai

License: Apache License 2.0

Shell 0.18% JavaScript 1.52% Python 17.13% CSS 1.01% HTML 0.10% Jupyter Notebook 80.07%

fastkafka's People

Contributors

davorrunje avatar harishmohanraj avatar joshrosenblum avatar kumaranvpl avatar rjambrecic avatar sternakt 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

Watchers

 avatar

fastkafka's Issues

Support for other protocols (AWS SQS, google cloud pubsub, RabbitMQ, ..)

I really like the idea of this, as the biggest gripe I have with most pub/sub solutions is all of the tedious boiler plate code needed to correctly subscribe and publish and manage message leases etc. While you often just want to grab a message, do some processing and put it on a different queue.

One of the most obvious improvements would be supporting more pubsub backends (thinking about AWS SQS, google cloud pubsub, RabbitMQ, ...)

https://www.reddit.com/r/Python/comments/11paz9u/comment/jbxf1v8/?utm_source=share&utm_medium=web2x&context=3

Create CLI command for deploying FastKafka service on AWS

e.g.

fastkafka aws deploy kafka_service:kafka_app --working_dir=. --param1=value1 --param2=value2
--name=production-kafka-service
--requirements-file-name=requirements.txt
--instance-type=m5.xlarge

  • some kind of docker based volume mapping etc.

(potentially some other params that are supported by AWS) there will be some other things to look for

fastkafka aws ls

fastkafka aws stop --name=production-kafka-service

Chose producer_cls globally and for each producer

I'd like to use something like this:

def make_func_push(func: Callable) -> Callable:
    """Decores func or method, making it push metrics into Prometeus."""
    return prometheus_pusher(metrics=[metrics.metric_factory.get_metrics()], job=pod_name)(metrics.calculate(func))


class PushingProducer(AIOKafkaProducer):
    """Pushing to Prometeus Kafka producer."""

    send = make_func_push(AIOKafkaProducer.send)
    send_batch = make_func_push(AIOKafkaProducer.send_batch)

as producer for whole application by default or with chosen producers.

For now, monkeypatch is an option, but I'd thank much for more flexible solution.

Enable FastAPI + FastKafka testing

@pytest.fixture
async def app(fastkafka_tester: Tester):
    app = prepare_fastapi_app()
    async with fastkafka_tester.fastapi_lifespan(settings.KAFKA.NAME)(app):
        yield app

If I'm using this fixture to test FastAPI application on sequence, having producer's call, I'm receiving

>       fut = await producer.send(
            topic, encoder_fn(wrapped_val.message), key=wrapped_val.key
        )
E       AttributeError: 'NoneType' object has no attribute 'send'

Because producers were not instantiated properly.
Am I doing something wrong?

Also this works:

@pytest.fixture
async def app(fastkafka_app: FastKafka):
    app = prepare_fastapi_app()
    async with fastkafka_app.fastapi_lifespan(settings.KAFKA.NAME)(app):
        yield app

Documented async docs generation issues

Async docs generation fails when Tuples are nested in examples
Async docs generation fails when Enum is defined as one of the values

Needs more exploration and reproducible example

Fallback of being able to work on Sync stuff with process workers

As a small possibly suggestion, perhaps to make possible fallback of being able to work on Sync stuff with process workers?

Recently tried FastAPI and was not fascinated that it works in anyio async engine which severely crippled celery working in a normal way. (Broken task discovery, not working global initialised stuff) Too many async engines around with no uniform compatibility to them.

Having option to run as sync / processes can be good idea for stability of usage for prod

https://discordapp.com/channels/267624335836053506/366673702533988363/1086276920662040637

Make YT video for Introducing FastKafka

You should tweak the presentation to introduce a concept on a simple example and then show how an actual project would use it. The actual project should be something concrete (separate repo), using only the standard Python toolkit (no notebook and nbdev). The Iris model is fine, but maybe we can find something more exciting to use.

Support bytes type

Check 001_ConsumerLoop _decode_msgs_and_send function.

NOTE: If type bytes, the message should not be decoded but sent to consumer callback as is so that the user can then manually decode the message inside consumer callback

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.