Skip to content

Commit 5bda38e

Browse files
committed
Use io.Closer interface instead of NotificationConnection
1 parent 96fbddd commit 5bda38e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

extension/amqp/amqp.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package amqp
22

33
import (
4+
"io"
5+
46
"github.com/streadway/amqp"
57
)
68

79
// setup returns a connection and channel to be used for the Queue setup
8-
func setup(url, queue string) (NotificationConnection, NotificationChannel, error) {
10+
func setup(url, queue string) (io.Closer, NotificationChannel, error) {
911
conn, err := amqp.Dial(url)
1012
if err != nil {
1113
return nil, nil, err
@@ -27,8 +29,3 @@ func setup(url, queue string) (NotificationConnection, NotificationChannel, erro
2729
type NotificationChannel interface {
2830
Publish(exchange, queue string, mandatory, immediate bool, msg amqp.Publishing) error
2931
}
30-
31-
// NotificationConnection represents a connection to the notification queue
32-
type NotificationConnection interface {
33-
Close() error
34-
}

extension/amqp/publisher.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package amqp
22

33
import (
44
"context"
5+
"io"
56

67
"github.com/hellofresh/goengine"
78
"github.com/hellofresh/goengine/driver/sql"
@@ -17,14 +18,14 @@ type NotificationPublisher struct {
1718
queue string
1819
logger goengine.Logger
1920

20-
connection NotificationConnection
21+
connection io.Closer
2122
channel NotificationChannel
2223
}
2324

2425
// NewNotificationPublisher returns an instance of NotificationPublisher
2526
func NewNotificationPublisher(amqpDSN, queue string,
2627
logger goengine.Logger,
27-
connection NotificationConnection,
28+
connection io.Closer,
2829
channel NotificationChannel,
2930
) (*NotificationPublisher, error) {
3031

0 commit comments

Comments
 (0)