From 0dbbfb4a59589f463febebe9d3f0275b7451604a Mon Sep 17 00:00:00 2001 From: Carlos Filipe Conceicao Date: Wed, 20 Nov 2019 09:06:44 +0100 Subject: [PATCH] add link durability and expiry session to target --- client.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/client.go b/client.go index a77951a2..1476de01 100644 --- a/client.go +++ b/client.go @@ -1756,6 +1756,43 @@ func LinkMaxMessageSize(size uint64) LinkOption { } } +// LinkTargetDurability sets the target durability policy. +// +// Default: DurabilityNone. +func LinkTargetDurability(d Durability) LinkOption { + return func(l *link) error { + if d > DurabilityUnsettledState { + return errorErrorf("invalid Durability %d", d) + } + + if l.target == nil { + l.target = new(target) + } + l.target.Durable = d + + return nil + } +} + +// LinkTargetExpiryPolicy sets the link expiration policy. +// +// Default: ExpirySessionEnd. +func LinkTargetExpiryPolicy(p ExpiryPolicy) LinkOption { + return func(l *link) error { + err := p.validate() + if err != nil { + return err + } + + if l.target == nil { + l.target = new(target) + } + l.target.ExpiryPolicy = p + + return nil + } +} + // LinkSourceDurability sets the source durability policy. // // Default: DurabilityNone.