feat(broker): add rabbitmq publisher interface and struct
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package broker
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
amqp "github.com/rabbitmq/amqp091-go"
|
||||
)
|
||||
|
||||
type Publisher interface {
|
||||
Publish(ctx context.Context, routingKey string, body []byte) error
|
||||
Close() error
|
||||
}
|
||||
|
||||
type RabbitPublisher struct {
|
||||
url string
|
||||
conn *amqp.Connection
|
||||
ch *amqp.Channel
|
||||
confirms chan amqp.Confirmation
|
||||
}
|
||||
Reference in New Issue
Block a user