项目作者: technologicgroup

项目描述 :
Examples for cluster-boost library
高级语言: Java
项目地址: git://github.com/technologicgroup/cluster-boost-examples.git
创建时间: 2020-07-08T14:30:51Z
项目社区:https://github.com/technologicgroup/cluster-boost-examples

开源协议:

下载


cluster-boost library examples

Version 1.1

Overview

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.

Example 1

Structure

  1. .
  2. ├--domain
  3. ├--TestAccessor.java
  4. ├--TestKey.java
  5. ├--TestRepository.java
  6. ├--TestValue.java
  7. ├--Application.java
  8. ├--ApplicationConfig.java
  9. ├--ClusterReadyConsumer.java

Features

  • Self-registered repositories
  • Cluster ready event

Code snippet

  1. @Repository
  2. public class TestRepository extends CommonRepository<TestKey, TestValue> {
  3. }

Example 2

Features

  • Run bean as a cluster task
  • Cluster ready event

Code snippet

  1. if (cluster.isFirstNode()) {
  2. Collection<Integer> results = cluster.runBean(RunnableBean.class, "<Test Argument>");
  3. log.info("Cluster run result: {}", results);
  4. }

Example 3

Features

  • Chain running
  • Cluster ready event

Code snippet

  1. Collection<ChainResult<String>> results = Chain.of(cluster)
  2. .map(ChainBean1.class, "Chain argument") // Start chain with string argument
  3. .filter(r -> r.getResult() == 1) // Continue chain only for odd nodes
  4. .map(ChainBean2.class) // On even nodes create a string result
  5. .run(); // Run chain steps

Example 4

Features

  • Chain running with audit
  • Self-registered repositories
  • Cluster ready event

Code snippet

  1. if (cluster.isFirstNode()) {
  2. Collection<ChainResult<String>> results = Chain.of(cluster)
  3. .track(trackingId) // Track all chain steps with trackingId
  4. .map(ChainBean1.class, "Chain argument") // Start chain with string argument
  5. .filter(r -> r.getResult() == 1) // Continue chain only for odd nodes
  6. .map(ChainBean2.class) // On even nodes create a string result
  7. .run(); // Run chain steps
  8. log.info("Chain result: {}", results);
  9. // Get audit items for tracking id
  10. List<AuditItem> auditItems = auditService.getItems(trackingId);
  11. log.info("Audit items: {}", auditItems);
  12. }