当前位置:网站首页>Learn redisson from scratch ------- topics (subscription and distribution)
Learn redisson from scratch ------- topics (subscription and distribution)
2022-07-24 17:59:00 【51CTO】
One 、Redisson As message middleware
little does one think Redisson Actually, it has the function of subscription and publishing , Be similar to RabbitMQ. I was using Redis When , You can use List The left in right out feature of this data type , Be able to do message oriented middleware . I don't know this time Redisson Is the bottom layer implemented in this way .Redis Implement middleware gateway : The fourth quarter, List As message middleware
Let me assume that a user object is pushed . The implementation idea is to transmit the front end to a user ID To come over . We found this user in the database , Then insert the user object Redisson In the message queue of . Write another listener , Keep getting messages from the queue .
Two 、 Technical reference points
actual combat : Production code
Core code TopicService. Method accepts a user object . And then through Redisson Client's getTopic Method to get RTopic object . Finally, we need to push MUser object , Use RTopic Object's publish Method to join the message queue . Refer to the above documents .
actual combat : Consumer code
In order to let us have an object similar to a listener , We can implement a system called ApplicationRunner Interface , Then the implementation class will always be in memory .
Realization Ordered The interface makes a sequence for it , Because there may be more than one ApplicationRunner Implementation class of interface .
3、 ... and 、 Realization effect

边栏推荐
- int8 & int8,你栽过这样的跟头吗?
- 0621~ES&Lucene
- Shengxin commonly used analysis graphics drawing 02 -- unlock the essence of volcano map!
- Opencv picture rotation
- Tensorflow introductory tutorial (40) -- acunet
- Section 11 cache avalanche, hot data failure follow Daewoo redis ------- directory post
- 运维小白成长记——架构第8周
- 干货|值得收藏的三款子域名收集工具
- Int8 & int8, have you ever stumbled like this?
- Quickly complete the unit test junit4 setting of intelij idea
猜你喜欢

Definition and storage of adjacency table and adjacency storage of directed graph and undirected graph

手写博客平台~第二天

Huawei machine test - topic core test point

安装JumpServer

How does win11 enhance the microphone? Win11 enhanced microphone settings

es(1)

C语言自定义类型讲解 — 结构体

Review and analysis of noodle dishes

SV casts and constants
![[network security] analysis vulnerability of website Middleware](/img/3a/9c034c17d65348aa7c35a3dac2039c.png)
[network security] analysis vulnerability of website Middleware
随机推荐
Int8 & int8, have you ever stumbled like this?
Simple test JS code
头文件是必须的吗?跟一跟编译过程~~~
Can CSC open an account for domestic futures? Is it safe?
Alibaba /1688 API instructions for searching products by map (pailitao)
Gan Development Series II (pggan, Singan)
05mysql lock analysis
Dry goods | three sub domain name collection tools worth collecting
0701~ holiday summary
C语言实现静态版本的通讯录
0623~放假自习
Still reading logs on the command line? Use kibana, visual log analysis yyds!
700. 二叉搜索树中的搜索-dfs法
Use prometheus+grafana to monitor MySQL performance indicators
1688/ Alibaba searches new product data by keyword API instructions
Tensorflow introductory tutorial (37) -- DC Vnet
List of stringutils and string methods
ansible自动化运维详解(五)ansible中变量的设定使用、JINJA2模板的使用以及ansible的加密控制
简单测试JS代码
SV casts and constants