当前位置:网站首页>Sentinelresource annotation details
Sentinelresource annotation details
2022-06-26 20:11:00 【A rookie is a great God】
SentinelResource annotation Attribute summary .
> This article is based on Sentinel 1.6.2, theoretical support 1.4.0+
attribute | effect | Whether must |
---|---|---|
value | Resource name | yes |
entryType | entry type , Mark the direction of the flow , Value IN/OUT, The default is OUT | no |
blockHandler | Handle BlockException The function name of . Function requirements : 1. Must be public 2. The return type is the same as the original method 3. The parameter type needs to match the original method , And add... At the end BlockException Parameters of type .4. By default, it needs to be in the same class as the original method . If you want to use functions of other classes , Configurable blockHandlerClass , And designate blockHandlerClass The method inside . | no |
blockHandlerClass | Deposit blockHandler Class . The corresponding processing function must be static modification , Otherwise, it cannot be parsed , Other requirements : Same as blockHandler. | no |
fallback | Used to provide... When an exception is thrown fallback Processing logic .fallback Functions can be used for all types of exceptions ( except exceptionsToIgnore The types of exceptions excluded ) To deal with . Function requirements :1. The return type is the same as the original method 2. The parameter type needs to match the original method ,Sentinel 1.6 Start , Or at the end of the method Add Throwable Parameters of type .3. By default, it needs to be in the same class as the original method . If you want to use functions of other classes , Configurable fallbackClass , And designate fallbackClass The method inside . | no |
fallbackClass【1.6】 | Deposit fallback Class . The corresponding processing function must be static modification , Otherwise, it cannot be parsed , Other requirements : Same as fallback. | no |
defaultFallback【1.6】 | For general purpose fallback Logic . Default fallback Functions can be used for all types of exceptions ( except exceptionsToIgnore The types of exceptions excluded ) To deal with . If you configure fallback and defaultFallback, With fallback Subject to . Function requirements :1. The return type is the same as the original method 2. The method parameter list is empty , Or there's a Throwable Parameters of type .3. By default, it needs to be in the same class as the original method . If you want to use functions of other classes , Configurable fallbackClass , And designate fallbackClass The method inside . | no |
exceptionsToIgnore【1.6】 | Specify which exceptions to exclude . Excluded exceptions are not counted in the exception statistics , And will not enter fallback Logic , It's the same thing . | no |
exceptionsToTrace | need trace It's abnormal | Throwable |
> TIPS
>
> - 1.6.0 Previous version fallback Function is only for degraded exceptions (DegradeException
) To deal with , Can't handle business exceptions .
> - if blockHandler and fallback It's all configured , It is degraded by current limiting and thrown BlockException
It will only enter blockHandler
Processing logic . If not configured blockHandler
、fallback
and defaultFallback
, When it is degraded by current limiting, it will BlockException
Direct selling .
> - from 1.4.0 Version start , Annotation method definition resource supports automatic statistics of business exceptions , No manual call required Tracer.trace(ex)
To record business exceptions .Sentinel 1.4.0 Previous versions needed to call themselves Tracer.trace(ex)
To record business exceptions .
边栏推荐
- Super VRT
- 慕课11、微服务的用户认证与授权
- Successfully solved the problem of garbled microservice @value obtaining configuration file
- 开发者调查:Rust/PostgreSQL 最受喜爱,PHP 薪水偏低
- (树) 树状数组
- Redis Basics
- Project practice 4: user login and token access verification (reids+jwt)
- Separate save file for debug symbols after strip
- Gd32 USB composite device file descriptor
- MySQL - database creation and management
猜你喜欢
Project practice 5: build elk log collection system
Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023
刷新三观的HP-UX系统中的强指针赋值出core问题
好物推荐:移动端开发安全工具
Feitian +cipu body brings more imagination to the metauniverse
Some cold knowledge about QT database development
数据库SQL语句撰写
Tree array
慕课11、微服务的用户认证与授权
抖音实战~分享模块~复制短视频链接
随机推荐
Development of NFT for digital collection platform
Bonne Recommandation: développer des outils de sécurité pour les terminaux mobiles
tsconfig. json
MongoDB实现创建删除数据库、创建删除表(集合)、数据增删改查
BOM and DOM operations
Arduino UNO + DS1302利用31字节静态RAM存储数据并串口打印
Jsonutils tool class (based on Alibaba fastjson)
证券开户安全吗,有没有什么危险呢
IDEA 报错:Process terminated【已解决】
Project practice 6: distributed transaction Seata
抖音实战~分享模块~生成短视频二维码
Boot indicator monitoring
Pinda general permission system (day 1~day 2)
浏览器事件循环
JWT操作工具类分享
Boot指标监测
Analysis on development technology of NFT meta universe chain game system
Unit test of boot
Tiktok practice ~ search page ~ video details
Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023