robinhood / faust

Python Stream Processing
Other
6.72k stars 535 forks source link

[Question] Integrating Faust with FastAPI framework #399

Open aorumbayev opened 5 years ago

aorumbayev commented 5 years ago

Hi all,

Sorry for not following the issue template as this is not a bug issue but a question. Description

I am currently investigating possibilities on integration with FastAPI, and was wondering if anyone in the community already had an experience with setting up a simple Faust service running along with FastAPI integrated?

Here is the duplicate issue on their repo.

It seems like both Faust and FastAPI run on their own event loops. FastAPI is based on Uvicorn that is based on Uvloop. I am not sure whether It makes sense to attempt to synchronise the event loops here or simply run Faust as a separate service communicating with FastAPI.

Will appreciate any response :-)

aorumbayev commented 5 years ago

For reference, Same issue on FastAPI repository has samples on integration: https://github.com/tiangolo/fastapi/issues/408

francbartoli commented 5 years ago

Any feedback on this question? I'm quite interested to know what kind of integration the Faust team suggests.

aorumbayev commented 5 years ago

@francbartoli you can follow this issue, aside from that, no updates :/

I might simply open a PR with solution proposed by @gitavi to Uvicorn repo next week and see if community will merge it or propose changes.

toh995 commented 3 years ago

I was able to integrate the two! Please see my example here: https://github.com/toh995/fastapi-faust-example

The README has a high level explanation of the architecture and how I was able to integrate Faust and FastAPI.

Comments and criticism are always welcome!