2019-05-29 18:46:57 +03:00
|
|
|
package nats
|
|
|
|
|
|
|
|
import (
|
2020-07-27 15:22:00 +03:00
|
|
|
"github.com/micro/go-micro/v3/broker"
|
2019-05-29 18:46:57 +03:00
|
|
|
nats "github.com/nats-io/nats.go"
|
|
|
|
)
|
|
|
|
|
|
|
|
type optionsKey struct{}
|
|
|
|
type drainConnectionKey struct{}
|
|
|
|
|
|
|
|
// Options accepts nats.Options
|
|
|
|
func Options(opts nats.Options) broker.Option {
|
|
|
|
return setBrokerOption(optionsKey{}, opts)
|
|
|
|
}
|
|
|
|
|
|
|
|
// DrainConnection will drain subscription on close
|
|
|
|
func DrainConnection() broker.Option {
|
2019-08-07 12:58:45 +03:00
|
|
|
return setBrokerOption(drainConnectionKey{}, struct{}{})
|
2019-05-29 18:46:57 +03:00
|
|
|
}
|