Update ref docs
- First set of changes for doc updates for M3 - Relates #88
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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[]
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user