This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 167
RSocket Broker Filter
linux_china edited this page Feb 28, 2020
·
5 revisions
RSocket Broker端提供了Filter机制,方便开发者对Broker进行功能扩展,典型的场景如:
- 可观测性(Observability): logging, metrics & tracing
- 动态路由(Dynamic Routing): 动态调整路由规则,如进行A/B测试等
- 审计(Audition): 构建服务调用链光鲜,可用于服务治理
- 断路保护(Circuit Breaker):
- 混沌测试(Chaos Testing): 服务不可用、服务超时、异常数据、安全入侵模拟等
- Feature Toggle: 针对某些特定的请求或者应用开启相关的特性
- 在alibaba-broker-server下新建一个Filter类,如XxxxxRSocketFilter,然后extends RSocketFilter,实现相关的抽象方法
- 将XxxxxRSocketFilter注册为Spring Bean,然后Broker会自动加载这个Filter
- 在RSocket Broker控制台的RSocket Filters,你可以看到broker加载的所有的filter,同时你可以enable/disable对应的filter
- RSocketExchange类提供了RSocket请求所有上下文信息,你可以修改路由等。
你可以参考样例代码: CanaryFilter
RSocketFilter包含一个refresh的方法,如果你要实现在UI端动态规则调整,只需要实现这个refresh接口。
public abstract class RSocketFilter {
/**
* refresh filter logic dynamically
*
* @param properties properties configuration
*/
public void refresh(String properties) {
}
}
- FF4J: Feature Toggle for Java https://ff4j.github.io/
- Binary: byte stream
- Async message
- Multi transports
- Reactive Semantics
- request/response
- request/stream
- fire-and-forget
- channel
- TCP+TLS
- WebSocket+TLS
- UDP(Aeron)
- RDMA