Documentation
¶
Index ¶
- Variables
- func Marshal(codec encoding.Codec, msg Any) ([]byte, error)
- func Unmarshal(codec encoding.Codec, inputData []byte, outValue interface{}) error
- type Any
- type Binder
- type Broker
- type Event
- type Handler
- type Headers
- type Message
- type Option
- func WithAddress(addressList ...string) Option
- func WithCodec(name string) Option
- func WithContext(ctx context.Context) Option
- func WithContextAndValue(k, v interface{}) Option
- func WithEnableSecure(enable bool) Option
- func WithErrorHandler(handler Handler) Option
- func WithGlobalPropagator() Option
- func WithGlobalTracerProvider() Option
- func WithPropagator(propagators propagation.TextMapPropagator) Option
- func WithTLSConfig(config *tls.Config) Option
- func WithTracerProvider(provider trace.TracerProvider, tracerName string) Option
- type Options
- type PublishOption
- type PublishOptions
- type SubscribeOption
- type SubscribeOptions
- type Subscriber
- type SubscriberMap
- type SubscriberSyncMap
- func (sm *SubscriberSyncMap) Add(topic string, sub Subscriber)
- func (sm *SubscriberSyncMap) Clear()
- func (sm *SubscriberSyncMap) ForceClear()
- func (sm *SubscriberSyncMap) Foreach(fnc func(topic string, sub Subscriber))
- func (sm *SubscriberSyncMap) Get(topic string) Subscriber
- func (sm *SubscriberSyncMap) Remove(topic string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultCodec encoding.Codec = nil
)
Functions ¶
Types ¶
type Broker ¶
type Broker interface { Name() string Options() Options Address() string Init(...Option) error Connect() error Disconnect() error Publish(ctx context.Context, topic string, msg Any, opts ...PublishOption) error Subscribe(topic string, handler Handler, binder Binder, opts ...SubscribeOption) (Subscriber, error) }
type Message ¶
func (Message) GetHeaders ¶
type Option ¶
type Option func(*Options)
func WithContext ¶
func WithContextAndValue ¶
func WithContextAndValue(k, v interface{}) Option
func WithEnableSecure ¶
func WithErrorHandler ¶
func WithGlobalPropagator ¶
func WithGlobalPropagator() Option
func WithGlobalTracerProvider ¶
func WithGlobalTracerProvider() Option
func WithPropagator ¶
func WithPropagator(propagators propagation.TextMapPropagator) Option
func WithTLSConfig ¶
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider, tracerName string) Option
type Options ¶
type Options struct { Addrs []string Codec encoding.Codec ErrorHandler Handler Secure bool TLSConfig *tls.Config Context context.Context Tracings []tracing.Option }
func NewOptions ¶
func NewOptions() Options
func NewOptionsAndApply ¶ added in v2.0.5
type PublishOption ¶
type PublishOption func(*PublishOptions)
func WithPublishContext ¶
func WithPublishContext(ctx context.Context) PublishOption
func WithPublishContextAndValue ¶
func WithPublishContextAndValue(k, v interface{}) PublishOption
type PublishOptions ¶
func NewPublishOptions ¶
func NewPublishOptions(opts ...PublishOption) PublishOptions
func (*PublishOptions) Apply ¶
func (o *PublishOptions) Apply(opts ...PublishOption)
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
func DisableAutoAck ¶
func DisableAutoAck() SubscribeOption
func WithQueueName ¶
func WithQueueName(name string) SubscribeOption
func WithSubscribeContext ¶
func WithSubscribeContext(ctx context.Context) SubscribeOption
func WithSubscribeContextAndValue ¶
func WithSubscribeContextAndValue(k, v interface{}) SubscribeOption
type SubscribeOptions ¶
func NewSubscribeOptions ¶
func NewSubscribeOptions(opts ...SubscribeOption) SubscribeOptions
func (*SubscribeOptions) Apply ¶
func (o *SubscribeOptions) Apply(opts ...SubscribeOption)
type Subscriber ¶
type Subscriber interface { Options() SubscribeOptions Topic() string Unsubscribe() error }
type SubscriberMap ¶ added in v2.0.5
type SubscriberMap map[string]Subscriber
type SubscriberSyncMap ¶ added in v2.0.5
func NewSubscriberSyncMap ¶ added in v2.0.5
func NewSubscriberSyncMap() *SubscriberSyncMap
func (*SubscriberSyncMap) Add ¶ added in v2.0.5
func (sm *SubscriberSyncMap) Add(topic string, sub Subscriber)
func (*SubscriberSyncMap) Clear ¶ added in v2.0.5
func (sm *SubscriberSyncMap) Clear()
func (*SubscriberSyncMap) ForceClear ¶ added in v2.0.5
func (sm *SubscriberSyncMap) ForceClear()
func (*SubscriberSyncMap) Foreach ¶ added in v2.0.5
func (sm *SubscriberSyncMap) Foreach(fnc func(topic string, sub Subscriber))
func (*SubscriberSyncMap) Get ¶ added in v2.0.5
func (sm *SubscriberSyncMap) Get(topic string) Subscriber
func (*SubscriberSyncMap) Remove ¶ added in v2.0.5
func (sm *SubscriberSyncMap) Remove(topic string) error
Click to show internal directories.
Click to hide internal directories.