-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 《分布式IM即时通讯系统》-大后端平台-消息微服务-第10节
- Loading branch information
binghe001
committed
Feb 1, 2024
1 parent
0d7a9fa
commit 0248083
Showing
5 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
docs/md/project/im/platform/message/2024-01-30-chapter10.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: 第10节:消息监听回调流程的设计和实现 | ||
pay: https://articles.zsxq.com/id_ma4w7exlg1qk.html | ||
--- | ||
|
||
# 《分布式IM系统》大后端平台-消息服务-第10节:消息监听回调流程的设计和实现 | ||
|
||
作者:冰河 | ||
<br/>星球:[http://m6z.cn/6aeFbs](http://m6z.cn/6aeFbs) | ||
<br/>博客:[https://binghe.gitcode.host](https://binghe.gitcode.host) | ||
<br/>文章汇总:[https://binghe.gitcode.host/md/all/all.html](https://binghe.gitcode.host/md/all/all.html) | ||
<br/>源码获取地址:[https://t.zsxq.com/0dhvFs5oR](https://t.zsxq.com/0dhvFs5oR) | ||
|
||
> 沉淀,成长,突破,帮助他人,成就自我。 | ||
* 本节难度:★★☆☆☆ | ||
* 本节重点:对消息微服务监听回调消息的流程进行设计和实现,从源码级别掌握消息监听回调的流程,重点理解消息监听回调流程在整个分布式IM即时通讯系统中的流转过程,结合自身实际项目思考,将本节学到的知识灵活应用到自身实际项目中。 | ||
|
||
**大家好,我是冰河~~** | ||
|
||
在即时通讯SDK中,当发送消息完毕后会通过广播机制将消息的发送结果广播出去,那这些广播的消息数据怎么接收呢?该怎么处理这些数据呢?如何让整个消息的监听和回调流程形成闭环呢? | ||
|
||
## 一、前言 | ||
|
||
在即时通讯SDK篇章的《[第04节:消息监听与广播机制的设计与实现](https://articles.zsxq.com/id_almw6i45p8ve.html)》一节中,我们对消息的监听与广播机制进行了设计和实现。并且在即时通讯SDK中,提供统一处理消息发送结果数据的数据模型、流程设计和具体实现,使得集成即时通讯SDK的大后端平台或者其他业务系统,无需关心发送消息后的结果数据的处理流程,只需要实现简单的监听器接口,即可根据自身业务需求来处理发送消息的结果数据模型。 | ||
|
||
那如何设计和实现具体的监听逻辑呢?本节,我们就来一起设计和实现消息监听回调的流程。 | ||
|
||
## 二、本节诉求 | ||
|
||
对消息微服务监听回调消息的流程进行设计和实现,从源码级别掌握消息监听回调的流程,重点理解消息监听回调流程在整个分布式IM即时通讯系统中的流转过程,结合自身实际项目思考,将本节学到的知识灵活应用到自身实际项目中。 | ||
|
||
## 三、流程设计 | ||
|
||
在整个分布式IM即时通讯系统中,即时通讯SDK统一封装和实现消息的广播和监听的核心框架逻辑,对外提供消息监听的接口,并在接口中提供处理消息发送结果数据模型的方法,由集成即时通讯SDK的大后端平台或者其他业务系统实现消息监听的具体业务逻辑,也就是大后端平台或者其他业务系统实现消息监听的接口,并在具体实现方法中接收到消息发送的结果数据模型,根据具体需要来处理相关的业务逻辑。 | ||
|
||
<div align="center"> | ||
<img src="https://binghe.gitcode.host/images/project/im/2023-12-25-001.png?raw=true" width="70%"> | ||
<br/> | ||
</div> | ||
|
||
当即时通讯SDK发送消息并且需要回传结果数据时,会通过广播的方式来处理结果数据模型,同时,当即时通讯后端服务向用户终端发送消息后,会向消息中间件集群回传消息发送的结果数据,而即时通讯SDK接收到消息中间件集群中消息发送的结果数据,同样会通过广播的方式来处理结果数据模型,并且会在发送广播的方法中,调用监听器的方法来处理结果数据模型。 | ||
|
||
备注:上述描述来自:通讯SDK篇章的《[第04节:消息监听与广播机制的设计与实现](https://articles.zsxq.com/id_almw6i45p8ve.html)》一节。 | ||
|
||
接下来,我们就可以在消息微服务中实现具体的监听器,而不必关心即时通讯SDK中实现的具体逻辑。 | ||
|
||
## 查看完整文章 | ||
|
||
加入[冰河技术](http://m6z.cn/6aeFbs)知识星球,解锁完整技术文章与完整代码 |