Drools Kie Server игнорирует AgendaFilter

У меня есть две таблицы решений в одном проекте. Мое требование - выполнять только те правила, которые принадлежат одной таблице решений в любой данный момент времени. Я пытался использовать RuleNameEndsWithAgendaFilter("некоторый суффикс") с классом FireAllRulesCommand, но сервер Kie не фильтрует правила на основе переданного AgendaFilter. Он запускает все правила каждый раз.

Drools Workbench версии 7.2.0.Final и Drools Kie Server версии 7.2.0.Final.

Ниже приведен фрагмент кода для того же:

KieServicesConfiguration configuration = KieServicesFactory.newRestConfiguration(serverUrl, user, password);
Set<Class<?>> allClasses = new HashSet<Class<?>>();
allClasses.add(OrderItem.class);
configuration.addExtraClasses(allClasses);
configuration.setMarshallingFormat(MarshallingFormat.JAXB);

OrderItem oi = new OrderItem("Mobile", 7000.00, 0.00, "");

KieServicesClient client = KieServicesFactory.newKieServicesClient(configuration);

// work with rules
List<ExecutableCommand<?>> commands = new ArrayList<ExecutableCommand<?>>();
BatchExecutionCommandImpl executionCommand = new BatchExecutionCommandImpl(commands, "defaultKieSession");

InsertObjectCommand insertObjectCommand = new InsertObjectCommand();
insertObjectCommand.setOutIdentifier("orderItem");
insertObjectCommand.setObject(oi);

FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand();
fireAllRulesCommand.setAgendaFilter(new RuleNameEndsWithAgendaFilter("MyRuleSuffix", true));

commands.add(insertObjectCommand);
commands.add(fireAllRulesCommand);

RuleServicesClient ruleClient = client.getServicesClient(RuleServicesClient.class);

ServiceResponse<String> response = ruleClient.executeCommands(containerId, executionCommand);
System.out.println(response.getResult());

1 ответ

Вы не можете использовать стандартный класс RuleNameEndsWithAgendaFilter для фильтрации правил таблицы решений, потому что правила из одной таблицы не имеют равных окончаний.

Пытаться RuleNameStartsWithAgendaFilterвозможно после переименования ваших таблиц.

Другие вопросы по тегам