在NATS消息发布前添加流组创建检查

This commit is contained in:
2026-03-12 08:51:38 +08:00
committed by admin
parent 2cfbad55a3
commit 0798dcde37
+4
View File
@@ -79,6 +79,10 @@ func (q *natsMessageClient) publish(ctx context.Context, config interface{}, dat
if !ok {
return fmt.Errorf("无效的 NATS 配置类型")
}
err := q.createStreamGroup(ctx, cfg)
if err != nil {
return err
}
payload, err := json.Marshal(data)
if err != nil {
return fmt.Errorf("序列化数据失败: %w", err)