cluster-boost library examples
Every example is a spring-boot application that starts Ignite cluster with one node. Every example shows one (or more) of the cluster-boost library features.
.
├--domain
├--TestAccessor.java
├--TestKey.java
├--TestRepository.java
├--TestValue.java
├--Application.java
├--ApplicationConfig.java
├--ClusterReadyConsumer.java
- Self-registered repositories
- Cluster ready event
@Repository
public class TestRepository extends CommonRepository<TestKey, TestValue> {
}
- Run bean as a cluster task
- Cluster ready event
if (cluster.isFirstNode()) {
Collection<Integer> results = cluster.runBean(RunnableBean.class, "<Test Argument>");
log.info("Cluster run result: {}", results);
}
- Chain running
- Cluster ready event
Collection<ChainResult<String>> results = Chain.of(cluster)
.map(ChainBean1.class, "Chain argument") // Start chain with string argument
.filter(r -> r.getResult() == 1) // Continue chain only for odd nodes
.map(ChainBean2.class) // On even nodes create a string result
.run(); // Run chain steps
- Chain running with audit
- Self-registered repositories
- Cluster ready event
if (cluster.isFirstNode()) {
Collection<ChainResult<String>> results = Chain.of(cluster)
.track(trackingId) // Track all chain steps with trackingId
.map(ChainBean1.class, "Chain argument") // Start chain with string argument
.filter(r -> r.getResult() == 1) // Continue chain only for odd nodes
.map(ChainBean2.class) // On even nodes create a string result
.run(); // Run chain steps
log.info("Chain result: {}", results);
// Get audit items for tracking id
List<AuditItem> auditItems = auditService.getItems(trackingId);
log.info("Audit items: {}", auditItems);
}