chore: 并入 iotlcm-worker-svr 历史到 worker-svr/(原提交 96f0f4e)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package rabbitmq
|
||||
|
||||
import "context"
|
||||
|
||||
type DeliveryMetadata struct {
|
||||
DeliveryTag uint64
|
||||
Redelivered bool
|
||||
Consumer string
|
||||
Queue string
|
||||
Headers map[string]any
|
||||
}
|
||||
|
||||
type deliveryMetadataContextKey struct{}
|
||||
|
||||
func WithDeliveryMetadata(ctx context.Context, metadata DeliveryMetadata) context.Context {
|
||||
return context.WithValue(ctx, deliveryMetadataContextKey{}, metadata)
|
||||
}
|
||||
|
||||
func DeliveryMetadataFromContext(ctx context.Context) (DeliveryMetadata, bool) {
|
||||
metadata, ok := ctx.Value(deliveryMetadataContextKey{}).(DeliveryMetadata)
|
||||
return metadata, ok
|
||||
}
|
||||
Reference in New Issue
Block a user