03 — ExtensionPlugin 接入
1. 服务定义
- Service:
ExtensionPlugin - RPC:
Call(GenericRequest) returns (GenericResponse)
用于 命令/查询型 能力,不适合替代 pre_send 生命周期 Hook。
2. 路由规则
- 插件实现
ExtensionOperationHandler(Rust 宿主)或对外暴露ExtensionPlugingRPC。 - 按 operation 字符串最长前缀 匹配。
- 命名建议:
{域}.{子系统}.{动作},例如yourcorp.im.custom_query。
3. Social 读模型同步(不在 ExtensionPlugin)
好友、通讯录、群目录、pending 申请等 Social 读模型 已迁出 IM ExecuteSync:
| 数据 | 客户端路径 |
|---|---|
| 通讯录 / 群目录 | Social Gateway REST + flare-social-sdk SyncTask |
| 好友/入群申请 | IM DATA Notification(在线)+ REST 列表(离线补偿) |
不要 再通过 social.sync.* ExtensionPlugin 或 SYNC_KIND_GROUP_DIRECTORY 拉取群目录。
4. 与 Sync Orchestrator 的关系
sync-orchestrator仅编排 IM 域:会话列表、消息 seq、关键事件、会话成员。- Social 业务数据 禁止注入
ExecuteSyncpayload。
5. 自行扩展 operation
- 选定前缀,如
yourcorp.im.。 - 在独立服务或 bridge 中注册 handler。
- 使用
prost定义Any内消息,或复用flare-proto已有类型。 - 在
CapabilityService.ListCapabilities中登记目录项(可选)。
不要 在 flare-im-core 源码中硬编码你的 operation。