Skip to content

Commit

Permalink
fix: Update rabbitmq to have close function
Browse files Browse the repository at this point in the history
  • Loading branch information
sirateek committed Apr 18, 2023
1 parent 6f14c71 commit 20d8162
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type rabbitMQ struct {
type RabbitMQ interface {
Consume(processor Processor, consumerConfig ConsumerConfig) (*rabbitmq.Consumer, error)
GetPublisher() *rabbitmq.Publisher
CloseConnection()
}

func NewRabbitMQ(connectionString string) (RabbitMQ, error) {
Expand Down Expand Up @@ -55,6 +56,11 @@ func NewRabbitMQ(connectionString string) (RabbitMQ, error) {
}, nil
}

func (r *rabbitMQ) CloseConnection() {
r.publisher.Close()
r.conn.Close()
}

func (r *rabbitMQ) GetPublisher() *rabbitmq.Publisher {
return r.publisher
}
Expand Down

0 comments on commit 20d8162

Please sign in to comment.