Update ref docs

- First set of changes for doc updates for M3
- Relates #88
This commit is contained in:
Janne Valkealahti
2015-07-26 16:50:29 +01:00
parent e92a6c5a09
commit 706f1de232
11 changed files with 623 additions and 13 deletions

View File

@@ -67,6 +67,7 @@ public class Application {
}
//end::snippetA[]
//tag::snippetB[]
@Configuration
static class PersistHandlerConfig {
@@ -84,7 +85,9 @@ public class Application {
}
}
//end::snippetB[]
//tag::snippetC[]
public static class Order {
int id;
String state;
@@ -100,6 +103,7 @@ public class Application {
}
}
//end::snippetC[]
public static void main(String[] args) throws Exception {
Bootstrap.main(args);

View File

@@ -36,8 +36,10 @@ public class Persist {
private final PersistStateMachineHandler handler;
//tag::snippetA[]
@Autowired
private JdbcTemplate jdbcTemplate;
//end::snippetA[]
private final PersistStateChangeListener listener = new LocalPersistStateChangeListener();
@@ -62,6 +64,7 @@ public class Persist {
return buf.toString();
}
//tag::snippetB[]
public void change(int order, String event) {
Order o = jdbcTemplate.queryForObject("select id, state from orders where id = ?", new Object[]{order}, new RowMapper<Order>() {
public Order mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -70,7 +73,9 @@ public class Persist {
});
handler.handleEventWithState(MessageBuilder.withPayload(event).setHeader("order", order).build(), o.state);
}
//end::snippetB[]
//tag::snippetC[]
private class LocalPersistStateChangeListener implements PersistStateChangeListener {
@Override
@@ -82,5 +87,6 @@ public class Persist {
}
}
}
//end::snippetC[]
}