Documentation
¶
Index ¶
- func NewEventbusWithOption(option LocaledEventbusOption) (eb *localedEventbus)
- type ClusterEventbusOption
- type DeliveryOptions
- type Event
- type EventHandler
- type EventHead
- type Eventbus
- type LocaledEventbusOption
- type MultiMap
- func (h MultiMap) Add(key string, value string)
- func (h MultiMap) Empty() bool
- func (h MultiMap) Get(key string) (string, bool)
- func (h MultiMap) Keys() []string
- func (h MultiMap) Merge(o ...MultiMap)
- func (h MultiMap) Put(key string, value []string)
- func (h MultiMap) Remove(key string)
- func (h MultiMap) Values(key string) ([]string, bool)
- type NatsEventbusOption
- type ReplyFuture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEventbusWithOption ¶
func NewEventbusWithOption(option LocaledEventbusOption) (eb *localedEventbus)
Types ¶
type ClusterEventbusOption ¶
type ClusterEventbusOption struct {
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
PublicHost string `json:"publicHost,omitempty"`
PublicPort int `json:"publicPort,omitempty"`
Meta cluster.ServiceMeta `json:"meta,omitempty"`
Tags []string `json:"tags,omitempty"`
TLS cluster.ServiceTLS `json:"tls,omitempty"`
EventChanCap int `json:"eventChanCap,omitempty"`
WorkersMaxIdleTime time.Duration `json:"workersMaxIdleTime,omitempty"`
WorkersCommandTimeout time.Duration `json:"workersCommandTimeout,omitempty"`
WorkersCommandBufferSize int `json:"workersCommandBufferSize,omitempty"`
Workers int `json:"workers,omitempty"`
}
type DeliveryOptions ¶
type DeliveryOptions interface {
Add(key string, value string)
Put(key string, value []string)
Get(key string) (string, bool)
Keys() []string
Empty() bool
Values(key string) ([]string, bool)
Remove(key string)
AddTag(tags ...string)
}
func NewDeliveryOptions ¶
func NewDeliveryOptions() DeliveryOptions
type EventHandler ¶
type Eventbus ¶
type Eventbus interface {
Send(address string, v interface{}, options ...DeliveryOptions) (err error)
Request(address string, v interface{}, options ...DeliveryOptions) (reply ReplyFuture)
RegisterHandler(address string, handler EventHandler, tags ...string) (err error)
RegisterLocalHandler(address string, handler EventHandler, tags ...string) (err error)
Start(context context.Context)
Close(context context.Context)
}
func NewClusterEventbus ¶
func NewClusterEventbus(discovery cluster.ServiceDiscovery, option ClusterEventbusOption) (bus Eventbus, err error)
func NewEventbus ¶
func NewEventbus() Eventbus
func NewNatsEventbus ¶ added in v1.1.0
func NewNatsEventbus(discovery cluster.ServiceDiscovery, option NatsEventbusOption) (bus Eventbus, err error)
type LocaledEventbusOption ¶
type LocaledEventbusOption struct {
EventChanCap int `json:"eventChanCap,omitempty"`
WorkersMaxIdleTime time.Duration `json:"workersMaxIdleTime,omitempty"`
WorkersCommandTimeout time.Duration `json:"workersCommandTimeout,omitempty"`
WorkersCommandBufferSize int `json:"workersCommandBufferSize,omitempty"`
Workers int `json:"workers,omitempty"`
}
type NatsEventbusOption ¶ added in v1.1.0
type NatsEventbusOption struct {
Name string `json:"name,omitempty"`
Servers []string `json:"servers,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
MaxReconnects int `json:"maxReconnects,omitempty"`
ReconnectWaitSecond int `json:"reconnectWaitSecond,omitempty"`
RetryOnFailedConnect bool `json:"retryOnFailedConnect,omitempty"`
Meta cluster.ServiceMeta `json:"meta,omitempty"`
Tags []string `json:"tags,omitempty"`
TLS cluster.ServiceTLS `json:"tls,omitempty"`
EventChanCap int `json:"eventChanCap,omitempty"`
WorkersMaxIdleTime time.Duration `json:"workersMaxIdleTime,omitempty"`
WorkersCommandTimeout time.Duration `json:"workersCommandTimeout,omitempty"`
WorkersCommandBufferSize int `json:"workersCommandBufferSize,omitempty"`
Workers int `json:"workers,omitempty"`
}
type ReplyFuture ¶
type ReplyFuture interface {
Get(v interface{}) (err error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.