@Override public ServiceResponse<String> executeCommands(String id, String payload) { if( config.isRest() ) { return makeHttpPostRequestAndCreateServiceResponse( baseURI + "/containers/" + id, payload, String.class ); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new CallContainerCommand( id, payload ) ) ); return (ServiceResponse<String>) executeJmsCommand( script ).getResponses().get( 0 ); } }
/** * @deprecated use #executeCommandsWithResults */ @Deprecated @Override public ServiceResponse<String> executeCommands(String id, String payload) { if( config.isRest() ) { return makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/instances/" + id, payload, String.class); } else { CommandScript script = new CommandScript( Collections.singletonList((KieServerCommand) new CallContainerCommand(id, payload)) ); return (ServiceResponse<String>) executeJmsCommand( script, null, null, id ).getResponses().get( 0 ); } }
/** * @deprecated use #executeCommandsWithResults */ @Deprecated @Override public ServiceResponse<String> executeCommands(String id, Command<?> cmd) { if( config.isRest() ) { return makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse( loadBalancer.getUrl() + "/containers/instances/" + id, cmd, String.class, getHeaders(cmd) ); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new CallContainerCommand( id, serialize(cmd) ) ) ); return (ServiceResponse<String>) executeJmsCommand( script, cmd.getClass().getName(), null, id ).getResponses().get( 0 ); } }
/** * This method is deprecated on KieServicesClient as it was moved to RuleServicesClient * * @see RuleServicesClient#executeCommands(String, String) * @deprecated */ @Deprecated @Override public ServiceResponse<String> executeCommands(String id, String payload) { if( config.isRest() ) { return makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/instances/" + id, payload, String.class); } else { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new CallContainerCommand(id, payload))); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand(script, null, null, id).getResponses().get(0); return getResponseOrNullIfNoResponse(response); } }
/** * This method is deprecated on KieServicesClient as it was moved to RuleServicesClient * * @see RuleServicesClient#executeCommands(String, Command) * @deprecated */ @Deprecated @Override public ServiceResponse<String> executeCommands(String id, Command<?> cmd) { if( config.isRest() ) { return makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/instances/" + id, cmd, String.class, getHeaders(cmd) ); } else { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new CallContainerCommand(id, serialize(cmd)))); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand(script, cmd.getClass().getName(), null, id).getResponses().get(0); return getResponseOrNullIfNoResponse(response); } }
@Override public ServiceResponse<ExecutionResults> executeCommandsWithResults(String id, Command<?> cmd) { if( config.isRest() ) { return makeHttpPostRequestAndCreateServiceResponse( loadBalancer.getUrl() + "/containers/instances/" + id, cmd, (Class)ExecutionResultImpl.class, getHeaders(cmd) ); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new CallContainerCommand( id, serialize(cmd) ) ) ); ServiceResponse response = executeJmsCommand( script, cmd.getClass().getName(), 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; } }
@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; } }