Skip to content

Commit

Permalink
Expose az sender Close() (#254)
Browse files Browse the repository at this point in the history
* expose az sender close()

* fix UT
  • Loading branch information
karenychen authored Sep 11, 2024
1 parent 0b93207 commit cae3c4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions v2/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type AzServiceBusSender interface {
SendMessage(ctx context.Context, message *azservicebus.Message, options *azservicebus.SendMessageOptions) error
SendMessageBatch(ctx context.Context, batch *azservicebus.MessageBatch, options *azservicebus.SendMessageBatchOptions) error
NewMessageBatch(ctx context.Context, options *azservicebus.MessageBatchOptions) (*azservicebus.MessageBatch, error)
Close(ctx context.Context) error
}

// Sender contains an SBSender used to send the message to the ServiceBus queue and a Marshaller used to marshal any struct into a ServiceBus message
Expand Down
5 changes: 5 additions & 0 deletions v2/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ type fakeAzSender struct {
NewMessageBatchReturnValue *azservicebus.MessageBatch
NewMessageBatchErr error
SendMessageBatchReceivedValue *azservicebus.MessageBatch
CloseErr error
}

func (f *fakeAzSender) SendMessage(
Expand Down Expand Up @@ -370,3 +371,7 @@ func (f *fakeAzSender) NewMessageBatch(
options *azservicebus.MessageBatchOptions) (*azservicebus.MessageBatch, error) {
return f.NewMessageBatchReturnValue, f.NewMessageBatchErr
}

func (f *fakeAzSender) Close(ctx context.Context) error {
return f.CloseErr
}

0 comments on commit cae3c4d

Please sign in to comment.