Replies: 1 comment
-
针对我这个特定问题,发现了一个方式可以实现,因为我的权限判断插件在判断不通过时会返回205响应码,因此可以使用filter功能实现 kafka-logger: 如果插件不是改变响应码,而是其它行为,不清楚有没有更加通用的方式:可以在一个插件中实现逻辑,允许或阻止后续插件的执行 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We intends to use apisix to build our event tracking system.
We use two plugins with different priority:
For example, the req url just like: /event-track?biz_type=xxx¶m1=value1¶m2=value2&...
When request arrives, the biz_type_check plugin checks if the biz_type is provided and valid
Howerver, we found that the kafka-logger works and the log will be recorded into kafka in both cases.
How to skip the following kafka-logger plugin execution when the request does not pass the verification in the previous plugin?
Further, how to skip the next plugins in a particular plugin?
【In Chinese/中文】 请问如何在某个自定义的权限校验插件中,当校验不通过时,阻止后续的kafka-logger插件执行(不要记录和传输消息到kafka)
大家好,我是大数据研发工程师。目前在学习和调研apisix,打算用来构建公司数据埋点与采集系统。
apisix中我们使用到两个插件:
1)优先级高的是我们自己开发的参数校验插件,运行在rewrite阶段,
2)另外一个是官方的kafka-logger,用来将埋点采集的请求参数存储到kafka topic中
举个例子,假设我们的请求url是:/event-track?biz_type=xxx¶m1=value1¶m2=value2&...
我们需要对biz_type进行校验,
1)比如那些合法的biz_type (公司目前业务支持的,有个白名单), 放行,最终返回200并且记录到kafka中;
2)而不合法的或者错误的biz_type,这些我们认为是错误请求,不想后续继续处理,返回205,也不记录到kafka(为了节省kafka存储资源和后续处理资源)
但是我们发现不管是什么情况,kafka-logger都会执行,都记录了参数(包括不想处理的那些)
**用什么办法可以做到:在校验插件执行判断不通过时,让后续的kafka-logger跳过不要继续执行,节省资源?
或者更进一步地:在某个插件中可以有什么方式,来控制后续插件可以继续执行,或者跳过执行?**
Beta Was this translation helpful? Give feedback.
All reactions