New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Example for Apache Kafka (rdkafka) #397
Comments
I've never used it but according to this phrase "This producer has an internal polling thread and as such it doesn't need to be polled. It can be cheaply cloned to get a reference to the same underlying producer. The internal polling thread will be terminated when the FutureProducer goes out of scope." You can construct the producer at the start of your app and clone the producer and pass it to actix-web as App::data or App::app_data. Then you would have access to it in middleware and handler functions. |
@fakeshadow Thanks for the quick replay Yes I am trying to something like that but FutureProducer required tokio runtime and currently, I am using actix_rt, I have tried actix/actix-web#1283 (comment) that solution, but then I am getting tokio issue like actix-web internally using a different version then that snippet so it's not compiling I am not that much experienced with actix-web or rust |
actix-web uses tokio runtime. You can run any crates support tokio directly as long as it uses the same version of tokio as actix-web.(which currently is 0.2 and it's compat with the latest release rdkafka on crates.io) |
Thank you very much for this amazing library :)
I tried a lot of places but can't find a single working example of actix-web and Kafka ( i mostly interested in https://docs.rs/rdkafka/0.24.0/rdkafka/producer/future_producer/struct.FutureProducer.html so heavy tasks can be delegated to individual consumers like Sending an email or generating thumbnail etc..)
The text was updated successfully, but these errors were encountered: