@Inject
private CallbackService callbackService;
public void execute() throws Exception {
System.out.println("Request scoring for " + customer);
ScoreResult scoreResult = scoringService.getScoringForCustomer(customer);
if (scoreResult.isAsynchronousAnswer()) {
System.out.println("score requested, but will be delivered asynchronously after " + customer.getZipCode() + " milliseconds with correlation key " + scoreResult.getAsynchronousCorrelationKey());
businessProcess.setVariable("scoreResultCorrelationKey", scoreResult.getAsynchronousCorrelationKey());
callbackService.triggerAsynchronousCallback(customer, scoreResult.getAsynchronousCorrelationKey());
}
else {
System.out.println("score received immidately");
customer.setScoringPoints(scoreResult.getScoringPoints());
}
}