@@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultBroker default broker
|
||||
DefaultBroker Broker = NewBroker()
|
||||
)
|
||||
|
||||
|
||||
@@ -6,11 +6,13 @@ import (
|
||||
|
||||
type brokerKey struct{}
|
||||
|
||||
// FromContext returns broker from passed context
|
||||
func FromContext(ctx context.Context) (Broker, bool) {
|
||||
c, ok := ctx.Value(brokerKey{}).(Broker)
|
||||
return c, ok
|
||||
}
|
||||
|
||||
// NewContext savess broker in context
|
||||
func NewContext(ctx context.Context, s Broker) context.Context {
|
||||
return context.WithValue(ctx, brokerKey{}, s)
|
||||
}
|
||||
|
||||
@@ -181,7 +181,8 @@ func SubscribeErrorHandler(h Handler) SubscribeOption {
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: Queue sets the subscribers sueue
|
||||
// Queue sets the subscribers queue
|
||||
// Deprecated
|
||||
func Queue(name string) SubscribeOption {
|
||||
return func(o *SubscribeOptions) {
|
||||
o.Group = name
|
||||
|
||||
Reference in New Issue
Block a user