Forum: Building VoltDB Applications

Post: Async stored procedure call back with Java 8 lambdas.

Async stored procedure call back with Java 8 lambdas.
javadevmtl
Sep 4, 2016
Just curious... but this should work right?
The thing is that "Sp returned" never prints and my program is stuck waiting...
Though looking at Volt Dashboard the call to the SP does go up.

boolean test = client.callProcedure(c -> new ProcedureCallback() {
@Override
public void clientCallback(ClientResponse voltResponse) throws Exception {
System.out.println("Sp returned...");
final VoltTable[] results = voltResponse.getResults();
results[0].asScalarLong())

}
}, "MySp", field1, field 2);
javadevmtl
Sep 5, 2016
Never mind Lambda basics. This works...

boolean test = client.callProcedure( (ClientResponse voltResponse) -> {
try {
System.out.println("Sp...");
final VoltTable[] results = voltResponse.getResults();
results[0].asScalarLong())
}
catch(Exception ex) {
ex.printStackTrace();
}
}, "MySp", field1, field2);