Plug n Play REST API Development With Simple-Orchestrator

1. Sample Orchestrator Execution Flow:
Code for the Above Diagram: 
public interface CreditScoreContext extends HistoryContext {
String getSsn();
void setCreditScore(int score);
}
public interface LoanContext extends HistoryContext<String> {
LoanApplication getApplication();
int getCreditScore();
int getRiskScore();
void setLoanApproveStatus(boolean isApproved);
}
@Component
public class CreditScoreTask implements Task<CreditScoreContext> {
@Override
public void execute(CreditScoreContext context) throws OrchestratorException {
context.logHistory(this.getClass().getName());
String ssn = context.getSsn();
if(ssn != null && ssn.length()>0){
context.setCreditScore((ssn.charAt(0)-‘0’)*100);
} else
context.setCreditScore(0);
}
}
@Component
public class LoanTask implements Task<LoanContext> {
@Override
public void execute(LoanContext context) throws OrchestratorException {
context.logHistory(this.getClass().getName());
LoanApplication app = context.getApplication();
int creditScore = context.getCreditScore();
if(creditScore>650 && app.getSalary()>0 && app.getLoanAmount()/app.getSalary()<5)
context.setLoanApproveStatus(true);
else
context.setLoanApproveStatus(false);
}
}

Link: https://dzone.com/articles/plugampplay-rest-api-development-with-simple-orche?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev