270
queueType persistence.QueueType,
271
blob *commonpb.DataBlob,
273
>
274
>
version := 0
275
>
// TODO: remove once cluster_ack_level is removed from DB
276
>
clusterAckLevels := map[string]int64{}
277
>
query := q.session.Query(templateInsertQueueMetadataQuery,
278
>
queueType,
279
>
clusterAckLevels,
280
>
blob.Data,
281
>
blob.EncodingType.String(),
282
>
version,
283
>
).WithContext(ctx)
284
>
_, err := query.MapScanCAS(make(map[string]any))
285
>
if err != nil {
286
return fmt.Errorf("failed to insert initial queue metadata record: %v, Type: %v", err, queueType)
287
}
288
// it's ok if the query is not applied, which means that the record exists already.
290
}
291