|
|
@@ -10,6 +10,7 @@ import org.jetlinks.community.rule.engine.entity.RuleEngineExecuteLogInfo;
|
|
|
import org.jetlinks.community.rule.engine.entity.RuleInstanceEntity;
|
|
|
import org.jetlinks.community.rule.engine.enums.RuleInstanceState;
|
|
|
import org.jetlinks.community.rule.engine.event.handler.RuleEngineLoggerIndexProvider;
|
|
|
+import org.jetlinks.rule.engine.api.RuleData;
|
|
|
import org.jetlinks.rule.engine.api.RuleEngine;
|
|
|
import org.jetlinks.rule.engine.api.model.RuleEngineModelParser;
|
|
|
import org.jetlinks.rule.engine.api.model.RuleModel;
|
|
|
@@ -45,9 +46,15 @@ public class RuleInstanceService extends GenericReactiveCrudService<RuleInstance
|
|
|
return this.ruleEngine
|
|
|
.shutdown(id)
|
|
|
.then(createUpdate()
|
|
|
- .set(RuleInstanceEntity::getState, RuleInstanceState.stopped)
|
|
|
- .where(RuleInstanceEntity::getId, id)
|
|
|
- .execute())
|
|
|
+ .set(RuleInstanceEntity::getState, RuleInstanceState.stopped)
|
|
|
+ .where(RuleInstanceEntity::getId, id)
|
|
|
+ .execute())
|
|
|
+ .then();
|
|
|
+ }
|
|
|
+
|
|
|
+ public Mono<Void> execute(String id, RuleData ruleData) {
|
|
|
+ return this.ruleEngine.getTasks(id)
|
|
|
+ .map(task-> task.execute(ruleData))
|
|
|
.then();
|
|
|
}
|
|
|
|
|
|
@@ -62,17 +69,17 @@ public class RuleInstanceService extends GenericReactiveCrudService<RuleInstance
|
|
|
return ruleEngine
|
|
|
.startRule(entity.getId(), model)
|
|
|
.then(createUpdate()
|
|
|
- .set(RuleInstanceEntity::getState, RuleInstanceState.started)
|
|
|
- .where(entity::getId)
|
|
|
- .execute()).then();
|
|
|
+ .set(RuleInstanceEntity::getState, RuleInstanceState.started)
|
|
|
+ .where(entity::getId)
|
|
|
+ .execute()).then();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Mono<Integer> deleteById(Publisher<String> idPublisher) {
|
|
|
return Flux.from(idPublisher)
|
|
|
- .flatMap(id -> this.stop(id).thenReturn(id))
|
|
|
- .as(super::deleteById);
|
|
|
+ .flatMap(id -> this.stop(id).thenReturn(id))
|
|
|
+ .as(super::deleteById);
|
|
|
}
|
|
|
|
|
|
@Override
|