Skip to content

Commit cf34cb8

Browse files
committed
🚧 add rule engine thingsboard
1 parent 9601c38 commit cf34cb8

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

IOT-Guide-RuleEngine-ThingsBoard/src/main/java/iot/technology/thingsboard/ruleengine/service/ActorSystemContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import iot.technology.actor.ActorSystem;
44
import iot.technology.actor.core.ActorRef;
55
import lombok.extern.slf4j.Slf4j;
6-
import org.springframework.stereotype.Service;
6+
import org.springframework.stereotype.Component;
77

88
/**
99
* @author mushuwei
1010
*/
11-
@Service
1211
@Slf4j
12+
@Component
1313
public class ActorSystemContext {
1414

1515
private ActorSystem system;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package iot.technology.thingsboard.ruleengine.service;
2+
3+
import iot.technology.actor.core.AbstractActor;
4+
import iot.technology.actor.core.InitFailureStrategy;
5+
import iot.technology.actor.core.ProcessFailureStrategy;
6+
import iot.technology.actor.exception.ActorException;
7+
import iot.technology.actor.message.ActorMsg;
8+
import lombok.extern.slf4j.Slf4j;
9+
10+
/**
11+
* @author mushuwei
12+
*/
13+
@Slf4j
14+
public abstract class ContextAwareActor extends AbstractActor {
15+
16+
public static final int ENTITY_PACK_LIMIT = 1024;
17+
18+
protected final ActorSystemContext systemContext;
19+
20+
public ContextAwareActor(ActorSystemContext systemContext) {
21+
super();
22+
this.systemContext = systemContext;
23+
}
24+
25+
@Override
26+
public boolean process(ActorMsg msg) {
27+
return false;
28+
}
29+
30+
@Override
31+
public void destroy() throws ActorException {
32+
super.destroy();
33+
}
34+
35+
@Override
36+
public InitFailureStrategy onInitFailure(int attempt, Throwable t) {
37+
return super.onInitFailure(attempt, t);
38+
}
39+
40+
@Override
41+
public ProcessFailureStrategy onProcessFailure(Throwable t) {
42+
return super.onProcessFailure(t);
43+
}
44+
}

0 commit comments

Comments
 (0)