当前位置:网站首页>集群方法同步执行框架 Suona
集群方法同步执行框架 Suona
2022-07-01 02:18:00 【cocowwy点儿cn】
Suona
Suona一个去中心化的集群方法同步执行框架
Git地址:戳我
说明
项目借鉴XXL-job源码,以及SpingCloud的服务注册,实现单节点方法被调用时唤醒集群其余节点的方法,以达到去中心化的广播效果
场景
情景一:比如在使用 caffine/ hashMap作为服务节点的内存缓存的时候,这是有缺点的,因为在集群内,如果需要进行缓存清理操作,是需要对每个节点进行缓存清理的
情景二:类似于情景一,需要该服务的集群每个节点都执行某方法
如果需要解决这种方案,就得 MQ等中间件来实现广播的操作,那么如果中间件挂了,或者是不想那么麻烦来依靠外部的组件来进行怎么办呢?
那么,可以尝试使用 @Suona,旨在能够让开发者在单一节点的方法被调用的时候,触发其他节点的同步进行调用,来模拟广播的操作,而开发者仅需要使用一个注解来标记这个方法,即可达到拆箱即用的效果
使用方式
你只需要这样使用它:
@Service
public class ServiceA {
@Suona
public void sayA() {
// do sth.
}
}
这样,当集群内任意节点的方法被调用时,其余节点也会同时进行调用
使用环境
| TECHNOLOGY | ENV |
|---|---|
| JDK | 1.8+ |
| SpringCloud | discovery |
注意
如果使用了权限框架或者是自定义了web拦截器的需要注意一下:
由于Suona集群通讯采用内嵌的web接口进行,所以需要对该web请求进行放行: /suona/call
稳定版
<dependency>
<groupId>cn.cocowwy</groupId>
<artifactId>suona</artifactId>
<version>1.0.0</version>
</dependency>
快照版本见下,发布最新的代码
<dependency>
<groupId>cn.cocowwy</groupId>
<artifactId>suona</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<repositories>
<repository>
<id>snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
边栏推荐
- CorelDRAW 2022中文精简64位直装版下载
- Opencv -- Notes
- The latest wechat iPad protocol code obtains official account authorization, etc
- Ernie gram, an explicit and complete n-gram mask language model, implements explicit n-gram semantic unit knowledge modeling.
- Do you write API documents or code first?
- SWT / anr problem - storagemanagerservice stuck
- go导入自建包
- The image variables in the Halcon variable window are not displayed, and it is useless to restart the software and the computer
- Live shopping mall source code, realize left-right linkage of commodity classification pages
- Objects and object variables
猜你喜欢

Int and bit group turn to each other

思特奇加入openGauss开源社区,共同推动数据库产业生态发展

Video tutorial | Chang'an chain launched a series of video tutorial collections (Introduction)
2022年最新csdn涨薪技术栈-app自动化测试概述

Batch import of Excel data in applet

Rocketqa: cross batch negatives, de noised hard negative sampling and data augmentation

nacos配置中心使用教程

SWT/ANR问题--Binder Stuck

What are the applications of SMS in enterprises?

Machine learning 10 belief Bayesian classifier
随机推荐
Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]
The whole process of AS400 API from zero to one
SWT/ANR问题--Dump时间过长导致的SWT
What is the difference between port number and process number?
SWT / anr problem - SWT caused by long execution time of native method
How does the property send a text message to the owner?
org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
LabVIEW计算相机图像传感器分辨率以及镜头焦距
Machine learning 10 belief Bayesian classifier
【JS】【掘金】获取关注了里不在关注者里的人
[Agora] user management
The latest CSDN salary increase technology stack in 2022 overview of APP automated testing
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]
SWT / anr problem - deadlock
端口号和进程号的区别?
Pytorch - - Basic Reference North Deux élèves du secondaire peuvent comprendre [Rétropropagation et Gradient descendant]
求两个线段公共部分的长度
Analysis on user behavior loss of data exploration e-commerce platform
计算特殊奖金
CorelDRAW 2022 Chinese Simplified 64 bit direct download