在NATS消息发布前添加流组创建检查
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user