当前位置:网站首页>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

边栏推荐
- 213. Looting II - Dynamic Planning
- Huawei machine test - topic core test point
- 再见收费的Navicat!这款开源的数据库管理工具界面更炫酷!
- Link editing tips of solo blog posts illegal links
- 如何为超级通胀做好准备
- Df2net 3D model deployment
- Development Series III of GaN (lapgan, srgan)
- es(1)
- Install jumpserver
- What are the pitfalls from single architecture to distributed architecture?
猜你喜欢

安装JumpServer
![[leetcode] 30. Concatenate substrings of all words](/img/21/3965532a31553cfe6edf64ca5de3f4.png)
[leetcode] 30. Concatenate substrings of all words
How to remove the top picture of the bubble skin article details of solo blog

Getaverse, a distant bridge to Web3

SV casts and constants

Detailed explanation of ansible automatic operation and maintenance (V) the setting and use of variables in ansible, the use of jinja2 template and the encryption control of ansible

The use and Simulation of character and string library functions in C language

700. Search DFS method in binary search tree

Codeforces Round #794 (Div. 2)(A.B.C)

C语言中的字符与字符串库函数的使用以及模拟实现
随机推荐
Class bytecode file
0625~<config>-<bus>
Definition and storage of adjacency table and adjacency storage of directed graph and undirected graph
Brats18 - Multimodal MR image brain tumor segmentation challenge continued
继承与派生
Laravel笔记-用户登录时密码进行RSA加密(提高系统安全性)
700. Search DFS method in binary search tree
How to follow the "low coupling" design principle?
Gan Development Series II (pggan, Singan)
Still building projects from scratch? This upgraded rapid development scaffold is worth a try!
Step by step introduction to the development framework based on sqlsugar (12) -- split the content of the page module into components to realize the division and rule processing
How to quickly upload files to Google Lab
Ship new idea 2022.2 was officially released, and the new features are really fragrant!
《STL源码剖析》应该怎样读?
05mysql lock analysis
Link editing tips of solo blog posts illegal links
PXE高效批量网络装机
0630~ professional quality course
C语言编程训练题目:左旋字符串中的k个字符、小乐乐与欧几里得、打印箭型图案、公务员面试、杨树矩阵
mac数据库管理软件Navicat Premium Essentials Mac