Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive and Delete #79

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
24 changes: 12 additions & 12 deletions azbus/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
// If blank then messages are received from a Queue.
SubscriptionName string

// See azbus/receiver.go
ReceiveAndDelete bool
RenewMessageLock bool
RenewMessageTime time.Duration

Expand All @@ -83,7 +83,6 @@
Cfg ReceiverConfig

log Logger
mtx sync.Mutex
receiver *azservicebus.Receiver
options *azservicebus.ReceiverOptions
handlers []Handler
Expand Down Expand Up @@ -118,17 +117,21 @@

// function outlining.
func newReceiver(r *Receiver, log Logger, cfg ReceiverConfig, opts ...ReceiverOption) *Receiver {
var options *azservicebus.ReceiverOptions
if cfg.Deadletter {
options = &azservicebus.ReceiverOptions{
ReceiveMode: azservicebus.ReceiveModePeekLock,
SubQueue: azservicebus.SubQueueDeadLetter,
}
options := azservicebus.ReceiverOptions = azservicebus.ReceiverOptions{}

Check failure on line 120 in azbus/receiver.go

View workflow job for this annotation

GitHub Actions / Quality Control

expected '==', found '='
switch {
case cfg.Deadletter:
options.ReceiveMode = azservicebus.ReceiveModePeekLock
options.SubQueue = azservicebus.SubQueueDeadLetter
case cfg.ReceiveAndDelete:
options.ReceiveMode = azservicebus.ReceiveModeReceiveAndDelete
cfg.RenewMessageLock = false
default:
options.ReceiveMode = azservicebus.ReceiveModePeekLock
}

r.Cfg = cfg
r.azClient = NewAZClient(cfg.ConnectionString)
r.options = options
r.options = &options
r.handlers = []Handler{}
r.log = log.WithIndex("receiver", r.String())
for _, opt := range opts {
Expand Down Expand Up @@ -346,9 +349,6 @@
func (r *Receiver) close_() {
if r != nil {
if r.receiver != nil {
r.mtx.Lock()
defer r.mtx.Unlock()

err := r.receiver.Close(context.Background())
if err != nil {
azerr := fmt.Errorf("%s: Error closing receiver: %w", r, NewAzbusError(err))
Expand Down
Loading