@Override
protected void onExchange(Exchange exchange) throws Exception {
ObjectHelper.notNull(solverFactory, "solverFactory");
Solver solver = solverFactory.buildSolver();
Solution planningProblem = exchange.getIn().getMandatoryBody(Solution.class);
solver.setPlanningProblem(planningProblem);
solver.solve();
Solution bestSolution = solver.getBestSolution();
exchange.getOut().setBody(bestSolution);
// propagate headers and attachments
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
exchange.getOut().setAttachments(exchange.getIn().getAttachments());