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

This commit is contained in:
2026-01-29 14:23:50 +08:00
committed by 张斌
parent 2cfbad55a3
commit 0798dcde37

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)