Fallback Aspect
Fallback Aspect: Node fault degradation aspect, is a built-in aspect of the system. If the node fails to execute (relationType="Failure") more than a certain threshold within a certain time,
then it will trigger component fault degradation, skip the component, and connect the next node through Failure RelationType
, error content: skip fallback error
Node fault degradation aspect, for nodes such as restApiCall
, mqttClient
that interact with external services, when the external service is not available, using node degradation can protect system resources well.
TIP
This aspect needs to be manually imported.
# Configuration
Field | Type | Description | Default |
---|---|---|---|
ErrorCountLimit | int | After the number of errors reaches a certain limit within LimitDuration, skip degradation is executed | 0 |
LimitDuration | time.Duration | The duration of the degradation limit | None |
PointCutFunc | func(ctx types.RuleContext, msg types.RuleMsg, relationType string) bool | Used to determine whether to execute degradation logic, default all | true |
# Usage example
Reference example (opens new window)
//If 3 errors occur within 60s, skip the current node and continue to execute the next node, and resume after 60s
types.WithAspects(
&aspect.SkipFallbackAspect{
ErrorCountLimit: 3,
LimitDuration: time.Second * 60}
)
1
2
3
4
5
6
2
3
4
5
6
Edit this page on GitHub (opens new window)
Last Updated: 2024/10/30, 13:29:22