You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Can Celasun (JIRA)" <ji...@apache.org> on 2018/04/12 13:42:00 UTC

[jira] [Commented] (THRIFT-4553) are there any plans for add middle-ware support for thrift Go implementation?

    [ https://issues.apache.org/jira/browse/THRIFT-4553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16435562#comment-16435562 ] 

Can Celasun commented on THRIFT-4553:
-------------------------------------

Middleware, as in HTTP middleware, is unlikely to be added to the library since HTTP is just one of many transports supported by Thrift. Further, if it's only HTTP you care about, you can do it yourself since

{code}
thrift.NewThriftHandlerFunc(processor, protocolFactory, protocolFactory)
{code}

returns an {{http.HandlerFunc}}, which you can pass to any middleware library you want.

> are there any plans for add middle-ware support for thrift Go implementation?
> -----------------------------------------------------------------------------
>
>                 Key: THRIFT-4553
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4553
>             Project: Thrift
>          Issue Type: New Feature
>    Affects Versions: 0.11.0
>            Reporter: gansteed
>            Priority: Major
>
> version1:
> provide a function to register middleware, and chain processors all. each function can call `Next` to skip to next function. something like middle-ware implementation in gin[1]. 
> version2:
> provide two function in TSimpleServer, one for preProcess, one for afterProcess. and call them
> before and after `ok, err := processor.Process(defaultCtx, inputProtocol, outputProtocol)`, so they can use defaultCtx to do something.
>  
> middle-ware is useful for something like monitoring micro service, count execution time...etc.
>  
> [1]: https://github.com/gin-gonic/gin/blob/master/context.go#L104



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)