Este contenido no está disponible en el idioma seleccionado.
Chapter 3. Decision Server and KIE container commands in Red Hat Decision Manager
Red Hat Decision Manager supports server commands that you can send to Decision Server for server-related or container-related operations, such as retrieving server information or creating or deleting a container. The full list of supported Decision Server configuration commands is located in the org.kie.server.api.commands package in your Red Hat Decision Manager instance.
In the Decision Server REST API, you use the org.kie.server.api.commands commands as the request body for POST requests to http://SERVER:PORT/kie-server/services/rest/server/config. For more information about using the Decision Server REST API, see Chapter 1, Decision Server REST API for KIE containers and business assets.
In the Decision Server Java client API, you use the corresponding method in the parent KieServicesClient Java client as an embedded API request in your Java application. All Decision Server commands are executed by methods provided in the Java client API, so you do not need to embed the actual Decision Server commands in your Java application. For more information about using the Decision Server Java client API, see Chapter 2, Decision Server Java client API for KIE containers and business assets.
3.1. Sample Decision Server and KIE container commands Copiar enlaceEnlace copiado en el portapapeles!
The following are sample Decision Server commands that you can use with the Decision Server REST API or Java client API for server-related or container-related operations in Decision Server:
-
GetServerInfoCommand -
GetServerStateCommand -
CreateContainerCommand -
GetContainerInfoCommand -
ListContainersCommand -
CallContainerCommand -
DisposeContainerCommand -
GetScannerInfoCommand -
UpdateScannerCommand -
UpdateReleaseIdCommand
For the full list of supported Decision Server configuration and management commands, see the org.kie.server.api.commands package in your Red Hat Decision Manager instance.
You can run Decision Server commands individually or together as a batch REST API request or batch Java API request:
Batch REST API request to create, call, and dispose a KIE container (JSON)
Batch Java API request to retrieve, dispose, and re-create a KIE container
Each command in this section includes a REST request body example (JSON) for the Decision Server REST API and an embedded method example from the KieServicesClient Java client for the Decision Server Java client API.
- GetServerInfoCommand
Returns information about the Decision Server.
Example REST request body (JSON)
{ "commands" : [ { "get-server-info" : { } } ] }{ "commands" : [ { "get-server-info" : { } } ] }Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
KieServerInfo serverInfo = kieServicesClient.getServerInfo();
KieServerInfo serverInfo = kieServicesClient.getServerInfo();Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - GetServerStateCommand
Returns information about the current state and configurations of the Decision Server.
Example REST request body (JSON)
{ "commands" : [ { "get-server-state" : { } } ] }{ "commands" : [ { "get-server-state" : { } } ] }Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
KieServerStateInfo serverStateInfo = kieServicesClient.getServerState();
KieServerStateInfo serverStateInfo = kieServicesClient.getServerState();Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - CreateContainerCommand
Creates a KIE container in the Decision Server.
Expand Table 3.1. Command attributes Name Description Requirement containerMap containing the
container-id,release-iddata (group ID, artifact ID, version),status, and any other components of the new KIE containerRequired
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
ServiceResponse<KieContainerResource> response = kieServicesClient.createContainer("command-script-container", resource);ServiceResponse<KieContainerResource> response = kieServicesClient.createContainer("command-script-container", resource);Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - GetContainerInfoCommand
Returns information about a specified KIE container in Decision Server.
Expand Table 3.2. Command attributes Name Description Requirement container-idID of the KIE container
Required
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
ServiceResponse<KieContainerResource> response = kieServicesClient.getContainerInfo("command-script-container");ServiceResponse<KieContainerResource> response = kieServicesClient.getContainerInfo("command-script-container");Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - ListContainersCommand
Returns a list of KIE containers that have been created in the Decision Server.
Expand Table 3.3. Command attributes Name Description Requirement kie-container-filterOptional map containing
release-id-filter,container-status-filter, and any other KIE container properties by which you want to filter resultsOptional
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .status(KieContainerStatus.FAILED) .build(); KieContainerResourceList containersList = kieServicesClient.listContainers(filter);KieContainerResourceFilter filter = new KieContainerResourceFilter.Builder() .status(KieContainerStatus.FAILED) .build(); KieContainerResourceList containersList = kieServicesClient.listContainers(filter);Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - CallContainerCommand
Calls a KIE container and executes one or more runtime commands. For information about Red Hat Decision Manager runtime commands, see Chapter 4, Runtime commands in Red Hat Decision Manager.
Expand Table 3.4. Command attributes Name Description Requirement container-idID of the KIE container to be called
Required
payloadOne or more commands in a
BatchExecutionCommandwrapper to be executed on the KIE containerRequired
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
List<Command<?>> commands = new ArrayList<Command<?>>(); BatchExecutionCommand batchExecution1 = commandsFactory.newBatchExecution(commands, "defaultKieSession"); commands.add(commandsFactory.newFireAllRules()); ServiceResponse<ExecutionResults> response1 = ruleClient.executeCommandsWithResults("command-script-container", batchExecution1);List<Command<?>> commands = new ArrayList<Command<?>>(); BatchExecutionCommand batchExecution1 = commandsFactory.newBatchExecution(commands, "defaultKieSession"); commands.add(commandsFactory.newFireAllRules()); ServiceResponse<ExecutionResults> response1 = ruleClient.executeCommandsWithResults("command-script-container", batchExecution1);Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - DisposeContainerCommand
Disposes a specified KIE container in the Decision Server.
Expand Table 3.5. Command attributes Name Description Requirement container-idID of the KIE container to be disposed
Required
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
ServiceResponse<Void> response = kieServicesClient.disposeContainer("command-script-container");ServiceResponse<Void> response = kieServicesClient.disposeContainer("command-script-container");Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - GetScannerInfoCommand
Returns information about the KIE scanner used for automatic updates in a specified KIE container, if applicable.
Expand Table 3.6. Command attributes Name Description Requirement container-idID of the KIE container where the KIE scanner is used
Required
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
ServiceResponse<KieScannerResource> response = kieServicesClient.getScannerInfo("command-script-container");ServiceResponse<KieScannerResource> response = kieServicesClient.getScannerInfo("command-script-container");Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - UpdateScannerCommand
Starts or stops a KIE scanner that controls polling for updated KIE container deployments.
NoteAvoid using a KIE scanner with business processes. Using a KIE scanner with processes can lead to unforeseen updates that can then cause errors in long-running processes when changes are not compatible with running process instances.
Expand Table 3.7. Command attributes Name Description Requirement container-idID of the KIE container where the KIE scanner is used
Required
statusStatus to be set on the KIE scanner (
STARTED,STOPPED)Required
poll-intervalPermitted polling duration in milliseconds
Required only when starting scanner
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(10000); scannerResource.setStatus(KieScannerStatus. STARTED); ServiceResponse<KieScannerResource> response = kieServicesClient.updateScanner("command-script-container", scannerResource);KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(10000); scannerResource.setStatus(KieScannerStatus. STARTED); ServiceResponse<KieScannerResource> response = kieServicesClient.updateScanner("command-script-container", scannerResource);Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - UpdateReleaseIdCommand
Updates the release ID data (group ID, artifact ID, version) for a specified KIE container.
Expand Table 3.8. Command attributes Name Description Requirement container-idID of the KIE container to be updated
Required
releaseIdUpdated GAV (group ID, artifact ID, version) data to be applied to the KIE container
Required
Example REST request body (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Java client method
ServiceResponse<ReleaseId> response = kieServicesClient.updateReleaseId("command-script-container", "com.redhat:Project1:1.1");ServiceResponse<ReleaseId> response = kieServicesClient.updateReleaseId("command-script-container", "com.redhat:Project1:1.1");Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example server response (JSON)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow