Search in sources :

Example 6 with CallContainerCommand

use of org.kie.server.api.commands.CallContainerCommand in project droolsjbpm-integration by kiegroup.

the class RuleServicesClientImpl method executeCommandsWithResults.

@Override
public ServiceResponse<ExecutionResults> executeCommandsWithResults(String id, String payload) {
    if (config.isRest()) {
        return makeHttpPostRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/instances/" + id, payload, (Class) ExecutionResultImpl.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new CallContainerCommand(id, payload)));
        ServiceResponse response = executeJmsCommand(script, null, null, id).getResponses().get(0);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        if (response.getResult() instanceof String) {
            response.setResult(deserialize((String) response.getResult(), (Class) ExecutionResultImpl.class));
        }
        return response;
    }
}
Also used : CallContainerCommand(org.kie.server.api.commands.CallContainerCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) ExecutionResultImpl(org.drools.core.runtime.impl.ExecutionResultImpl) CommandScript(org.kie.server.api.commands.CommandScript)

Aggregations

CallContainerCommand (org.kie.server.api.commands.CallContainerCommand)6 KieServerCommand (org.kie.server.api.model.KieServerCommand)6 CommandScript (org.kie.server.api.commands.CommandScript)5 ServiceResponse (org.kie.server.api.model.ServiceResponse)5 ExecutionResultImpl (org.drools.core.runtime.impl.ExecutionResultImpl)2 CreateContainerCommand (org.kie.server.api.commands.CreateContainerCommand)2 DisposeContainerCommand (org.kie.server.api.commands.DisposeContainerCommand)2 ServiceResponsesList (org.kie.server.api.model.ServiceResponsesList)2 ArrayList (java.util.ArrayList)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 Category (org.junit.experimental.categories.Category)1 BatchExecutionCommand (org.kie.api.command.BatchExecutionCommand)1 ActivateContainerCommand (org.kie.server.api.commands.ActivateContainerCommand)1 DeactivateContainerCommand (org.kie.server.api.commands.DeactivateContainerCommand)1 GetContainerInfoCommand (org.kie.server.api.commands.GetContainerInfoCommand)1 GetReleaseIdCommand (org.kie.server.api.commands.GetReleaseIdCommand)1 GetScannerInfoCommand (org.kie.server.api.commands.GetScannerInfoCommand)1 GetServerInfoCommand (org.kie.server.api.commands.GetServerInfoCommand)1 GetServerStateCommand (org.kie.server.api.commands.GetServerStateCommand)1