Skip to content
This repository was archived by the owner on Mar 29, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion utils/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var (
"deliveryMode",
"priority",
"messageId",
"correlationId",
"expiration",
}
)

Expand All @@ -38,10 +40,12 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) {
deliveryMode = amqp.Transient
priority = uint8(0)
messageId = ""
correlationId = ""
expiration = ""
)

if wrongOpt, ok := checkOptions(opt); !ok {
return amqp.Publishing{}, fmt.Errorf("Wring option '%s'. Check the docs.", wrongOpt)
return amqp.Publishing{}, fmt.Errorf("Wrong option '%s'. Check the docs.", wrongOpt)
}

if opt != nil {
Expand All @@ -68,6 +72,14 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) {
if p, ok := opt["messageId"].(string); ok {
messageId = p
}

if p, ok := opt["correlationId"].(string); ok {
correlationId = p
}

if p, ok := opt["expiration"].(string); ok {
expiration = p
}
}

return amqp.Publishing{
Expand All @@ -77,6 +89,8 @@ func ConvertOpt(opt wabbit.Option) (amqp.Publishing, error) {
DeliveryMode: deliveryMode, // 1=non-persistent, 2=persistent
Priority: priority, // 0-9
MessageId: messageId,
CorrelationId: correlationId,
Expiration: expiration,
// a bunch of application/implementation-specific fields
}, nil
}
Expand Down