事件同步机制
事件同步提供将协同引擎内部事件发布出去的通道,便于业务系统订阅并处理(如审计、通知、索引同步等)。

适用场景
- 协同变更审计与回放
- 业务系统同步变更(搜索、索引、统计)
- 外部通知与告警
当前支持事件类型:
- 协同编辑:成功落库的 changeset
开启事件同步
在 .env.custom 中配置:
EVENT_SYNC=true在 values.yaml 中配置:
universer:
config:
rabbitmq:
eventSync: true消费者示例
参考 https://github.com/dream-num/univer-event-sync-example-go
事件结构
message EventSyncData {
string eventId = 1;
string eventType = 2; // type of event, now support changeset
int32 createdAt = 3;
oneof event {
univer.ChangesetAck csAckEvent = 4;
// more event types in the future.
}
}
message ChangesetAck {
univer.Changeset cs = 1;
}
message Changeset {
string unitID = 1; // unitID of the Univer document
univer.constants.UniverType type = 2;
int32 baseRev = 3;
int32 revision = 4;
string userID = 5;
repeated Mutation mutations = 6;
string memberID = 7;
}
message Mutation {
string id = 1; // ID of the mutation
string data = 2; // serialized params
}你觉得这篇文档如何?
