diff --git a/utils/opt.go b/utils/opt.go index 216791e..92c09cb 100644 --- a/utils/opt.go +++ b/utils/opt.go @@ -17,6 +17,8 @@ var ( "deliveryMode", "priority", "messageId", + "correlationId", + "expiration", } ) @@ -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 { @@ -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{ @@ -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 }