public ExecutionResults execute(Command command) {
String commandId = "ksession.execute" + messageSession.getNextId();
String kresultsId = "kresults_" + messageSession.getSessionId();
Message msg = new Message( messageSession.getSessionId(),
messageSession.counter.incrementAndGet(),
false,
new KnowledgeContextResolveFromContextCommand( new ExecuteCommand( commandId,
command ),
null,
null,
instanceId,
kresultsId ) );
try {
Object object = client.write( msg ).getPayload();if ( object == null ) {
throw new RuntimeException( "Response was not correctly received" );
}
return (ExecutionResults) ((ExecutionResults) object).getValue( commandId );
} catch ( Exception e ) {
throw new RuntimeException( "Unable to execute message",
e );
}
}