|
|
|
@ -19,16 +19,15 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.thingsboard.server.actors.ActorSystemContext; |
|
|
|
import org.thingsboard.server.actors.TbActor; |
|
|
|
import org.thingsboard.server.actors.TbActorId; |
|
|
|
import org.thingsboard.server.actors.TbStringActorId; |
|
|
|
import org.thingsboard.server.actors.TbEntityActorId; |
|
|
|
import org.thingsboard.server.actors.service.ContextAwareActor; |
|
|
|
import org.thingsboard.server.actors.service.ContextBasedCreator; |
|
|
|
import org.thingsboard.server.common.data.id.RuleChainId; |
|
|
|
import org.thingsboard.server.common.data.id.TenantId; |
|
|
|
import org.thingsboard.server.common.msg.TbActorMsg; |
|
|
|
import org.thingsboard.server.common.msg.aware.RuleChainAwareMsg; |
|
|
|
import org.thingsboard.server.common.msg.queue.RuleEngineException; |
|
|
|
|
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
public class RuleChainErrorActor extends ContextAwareActor { |
|
|
|
|
|
|
|
@ -43,9 +42,8 @@ public class RuleChainErrorActor extends ContextAwareActor { |
|
|
|
|
|
|
|
@Override |
|
|
|
protected boolean doProcess(TbActorMsg msg) { |
|
|
|
if (msg instanceof RuleChainAwareMsg) { |
|
|
|
if (msg instanceof RuleChainAwareMsg rcMsg) { |
|
|
|
log.debug("[{}] Reply with {} for message {}", tenantId, error.getMessage(), msg); |
|
|
|
var rcMsg = (RuleChainAwareMsg) msg; |
|
|
|
rcMsg.getMsg().getCallback().onFailure(error); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
@ -56,17 +54,19 @@ public class RuleChainErrorActor extends ContextAwareActor { |
|
|
|
public static class ActorCreator extends ContextBasedCreator { |
|
|
|
|
|
|
|
private final TenantId tenantId; |
|
|
|
private final RuleChainId ruleChainId; |
|
|
|
private final RuleEngineException error; |
|
|
|
|
|
|
|
public ActorCreator(ActorSystemContext context, TenantId tenantId, RuleEngineException error) { |
|
|
|
public ActorCreator(ActorSystemContext context, TenantId tenantId, RuleChainId ruleChainId, RuleEngineException error) { |
|
|
|
super(context); |
|
|
|
this.tenantId = tenantId; |
|
|
|
this.ruleChainId = ruleChainId; |
|
|
|
this.error = error; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TbActorId createActorId() { |
|
|
|
return new TbStringActorId(UUID.randomUUID().toString()); |
|
|
|
return new TbEntityActorId(ruleChainId); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|