符合springboot/cloud组件规范的微服务框架,可选任意组件搭配使用 版本管理使用nursery-spring-boot-dependencies、nursery-spring-cloud-dependencies,自动管理springboot/cloud和alibaba-spring-cloud的版本
基础starter、无损上下线
@Autowired
private BeeCombClient beeCombClient;
@Component
public class XXXJobHandler implements JobHandler {
…
}
NurseryBeeCombClientProperties NurseryBeeCombExecutorProperties
缓存框架,优雅的api集,删除缓存无需考虑事务提交、延迟删除等特性
@Autowired
private Cacher cacher;
默认使用redis缓存
@Autowired
private ElasticsearchClient elasticsearchClient;
@Autowired
private RestHighLevelClient restHighLevelClient;//V7版本
NurseryElasticsearchProperties
@Autowired
private HBaseEnv hbaseEnv;
Connection connection = hbaseEnv.getConnection();
NurseryHBaseProperties
可靠生产、消费,有序消费
@Autowired
private ReliabilityProducer reliabilityProducer;
NurseryKafkaProperties
ReliabilityConsumer
OrderedReliabilityConsumer
自动化mybatis
@Autowired
private MysqlMybatisLockMapper mapper;
DistributedLock lock = new MysqlMybatisLock(mapper, lockName, expireSeconds);
@Autowired
private MysqlMybatisLockMapper mapper;
DistributedReentrantLock lock = new MysqlMybatisReentrantLock(mapper, lockName, expireSeconds);
@Autowired
private MysqlMybatisReadWriteLockMapper mapper;
DistributedReentrantReadWriteLock lock = new MysqlMybatisReentrantReadWriteLock(mapper, lockName, expireSeconds);
不同于Nacos等注册中心,这个注册是抽象的,当没有注册中心设施时这个可以作为简易的注册中心 在大多数场景可以作为席位注册管理,例如雪花算法给每个实例自动分配唯一的datacenterId, machineId。
@Autowired
private MysqlMybatisLockMapper lockMapper;
@Autowired
private MysqlMybatisRegistryMapper mapper;
String name = "myservice";
String identifier = "127.0.0.1:8080";
String metadata = "{\"ts\":1000}";
String info = "{\"ts2\":2000}";
class MyRegistryListener implements RegistryListener {
public Integer index;
public Boolean leaseExpired;
@Override
public void onRegistered(Registration registration, Integer index) {
this.index = index;
}
@Override
public void onLeaseExpired(Registration registration) {
leaseExpired = true;
}
}
MysqlMybatisRegistry mysqlMybatisRegistry = new MysqlMybatisRegistry(lockMapper, mapper, new MyRegistryListener());
Registration registration = new Registration.Default(name, identifier, 30L, metadata, info);
RegisterResult result = registry.register(registration);
long datacenterId = SnowflakeSequenceManager.extractDatacenterId(result.getIndex());
long machineId = SnowflakeSequenceManager.extractMachineId(result.getIndex());
List<Registration> list = registry.listInstances(name);
registry.deregister(registration);
NurseryMybatisProperties
@Autowired
private RedisExecutor redisExecutor;
@Autowired
private RedisExecutor redisExecutor;
DistributedLock lock = new RedisLock(redisExecutor, lockName, expireSeconds);
@Autowired
private RedisExecutor redisExecutor;
DistributedReentrantLock lock = new RedisReentrantLock(redisExecutor, lockName, expireSeconds);
@Autowired
private RedisExecutor redisExecutor;
DistributedReentrantReadWriteLock lock = new RedisReentrantReadWriteLock(redisExecutor, lockName, expireSeconds);
NurseryRedisProperties
自动化shardingsphere的DataSource
自动化web的filter、异常handler
@Autowired
private ZooKeeperHolder zooKeeperHolder;
NurseryZookeeperProperties
自动化微服务调用传参配置、FlowTag负载均衡、无损上下线
符合openapi/api规范的网关
自动化seata集成
自动化sentinel集成