Hprose 中间件 - 执行顺序
优质
小牛编辑
137浏览
2023-12-01
Hprose 中间件的顺序执行是按照添加的前后顺序执行的,假设添加的中间件处理器分别为:handler1
, handler2
… handlerN
,那幺执行顺序就是 handler1
, handler2
… handlerN
。
不同类型的 Hprose 中间件和 Hprose 其它过程的执行流程如下图所示:
+------------------------------------------------------------------+
| +-----------------batch invoke----------------+ |
| +------+ | +-----+ +------+ +------+ +-----+ | |
| |invoke| | |begin| |invoke| ... |invoke| | end | | |
| +------+ | +-----+ +------+ +------+ +-----+ | |
| ^ +---------------------------------------------+ |
| | ^ |
| | | |
| v v |
| +-------------------+ +------------------+ |
| | invoke middleware | | batch middleware | |
| +-------------------+ +------------------+ |
| ^ ^ |
| | +---------------+ | |
| +---->| encode/decode |<-----+ |
| +---------------+ |
| ^ |
| | |
| v |
| +--------------------------+ |
| | before filter middleware | |
| +--------------------------+ |
| ^ |
| | _ _ ___ ____ ____ ____ ____ |
| v |__| |__] |__/ | | [__ |___ |
| +--------+ | | | | \ |__| ___] |___ |
| | filter | |
| +--------+ ____ _ _ ____ _ _ ___ |
| ^ | | | |___ |\ | | |
| | |___ |___ | |___ | \| | |
| v |
| +-------------------------+ |
| | after filter middleware | |
| +-------------------------+ |
+------------------------------------------------------------------+
^
|
|
v
+------------------------------------------------------------------+
| +--------------------------+ |
| | before filter middleware | |
| +--------------------------+ |
| ^ |
| | _ _ ___ ____ ____ ____ ____ |
| v |__| |__] |__/ | | [__ |___ |
| +--------+ | | | | \ |__| ___] |___ |
| | filter | |
| +--------+ ____ ____ ____ _ _ ____ ____ |
| ^ [__ |___ |__/ | | |___ |__/ |
| | ___] |___ | \ \/ |___ | \ |
| v |
| +-------------------------+ |
| | after filter middleware | |
| +-------------------------+ |
| ^ |
| | |
| v |
| +---------------+ |
| +----------->| encode/decode |<---------------------+ |
| | +---------------+ | |
| | | | |
| | | | |
| | v | |
| | +---------------+ | |
| | | before invoke |-------------+ | |
| | +---------------+ | | |
| | | | | |
| | | | | |
| | v v | |
| | +-------------------+ +------------+ | |
| | | invoke middleware |--->| send error |--+ |
| | +-------------------+ +------------+ |
| | | ^ |
| | | | |
| | v | |
| | +--------------+ | |
| | | after invoke |--------------+ |
| | +--------------+ |
| | | |
| | | |
| +--------------------+ |
+------------------------------------------------------------------+