Thriftpy / thriftpy2

Pure python approach of Apache Thrift.
MIT License
572 stars 91 forks source link

middleware-like behaviour #216

Closed Niccolum closed 1 year ago

Niccolum commented 1 year ago

Hello,

Thanks for your work, it's prettier, than raw thrift :)

So, i will use this soon, and now learning docs.

As i see, here is no somwthing, like middlewares in web framework, but i see, how to create this. As i understand, i need to modify TAsyncProcessor, process method.

Maybe, without rewriting make_server with this functionality - ot will be nice to have to pass something like middlewares to make_server function. Both, sync and async.

Or, there is another "thrift way" to do middlewares?

aisk commented 1 year ago

The current implementation is mostly equivalent to the original implementation (apache thrift), many concepts and classes do the same job as their equivalents in apache thrift.

As far as I know, there is not a middleware abstraction in apache thift.

But due to the dynamic natures, you can built the middleware mechanism easily by your own, and the make_server is just a helper function, and you can re implement for you own usages.

Please note that this is my personal opinions and maybe wrong.