Pull request #5: RED-155: Bump config service version to make sure, dictionaries and

Merge in RED/redaction-service from feature/RED-155 to master

* commit 'c80cae3fc361a651e120626daf26d39de1dc656f':
  No need to write or add rules to file in classpath.
  RED-155: Bump config service version to make sure, dictionaries and rules are pulled correctly.
This commit is contained in:
Cheng Zhu 2020-07-17 13:01:32 +02:00
commit fa7693e88b
2 changed files with 2 additions and 11 deletions

View File

@ -39,7 +39,7 @@
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>configuration-service-api-v1</artifactId>
<version>0.9.0</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>

View File

@ -29,8 +29,6 @@ public class DroolsExecutionService {
@Autowired
private KieContainer kieContainer;
private String currentDrlRules;
private long rulesVersion = -1;
public Section executeRules(Section section) {
@ -64,22 +62,15 @@ public class DroolsExecutionService {
KieServices kieServices = KieServices.Factory.get();
InputStream input = new ByteArrayInputStream(drlAsString.getBytes(StandardCharsets.UTF_8));
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.write("src/main/resources/drools/rules.drl", kieServices.getResources()
.newInputStreamResource(input));
kieFileSystem.write(kieServices.getResources().newInputStreamResource(input));
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
kieContainer.updateToVersion(kieModule.getReleaseId());
currentDrlRules = drlAsString;
} catch (Exception e) {
throw new RulesValidationException("Could not update rules", e);
}
}
public String getRules() {
return currentDrlRules;
}
}