Documentation ¶
Index ¶
- Constants
- func Serve(port int, handler broker) net.Listener
- type Broker
- func (b *Broker) Authenticate(transport transport.Metadata, sessionID []byte, username string, ...) (tenant string, err error)
- func (b *Broker) CloseSession(ctx context.Context, id string) error
- func (b *Broker) Connect(ctx context.Context, metadata transport.Metadata, p *packet.Connect) (string, *packet.ConnAck, error)
- func (b *Broker) Disconnect(ctx context.Context, id string, p *packet.Disconnect) error
- func (b *Broker) DistributeMessage(message *pb.MessagePublished) error
- func (b *Broker) Join(hosts []string)
- func (b *Broker) JoinServiceLayer(layer cluster.ServiceLayer)
- func (b *Broker) ListRetainedMessages() (topics.RetainedMessageSet, error)
- func (b *Broker) ListSessions() (sessions.SessionSet, error)
- func (b *Broker) ListSubscriptions() (subscriptions.SubscriptionSet, error)
- func (b *Broker) OnPublish(sess sessions.Session, p *packet.Publish) error
- func (b *Broker) OnSessionClosed(sess sessions.Session)
- func (b *Broker) OnSessionLost(sess sessions.Session)
- func (b *Broker) OnUnsubscribe(sess sessions.Session, packet *packet.Unsubscribe) error
- func (b *Broker) Publish(ctx context.Context, id string, p *packet.Publish) (puback *packet.PubAck, err error)
- func (b *Broker) RemoteRPCProvider(id, peer string) sessions.Transport
- func (b *Broker) RetainThenDispatchToLocalSessions(tenant string, topic []byte, payload []byte, qos int32)
- func (b *Broker) Serve(port int) net.Listener
- func (b *Broker) Shutdown()
- func (broker *Broker) Start(layer cluster.ServiceLayer)
- func (b *Broker) Stop()
- func (b *Broker) Subscribe(ctx context.Context, id string, p *packet.Subscribe) (*packet.SubAck, error)
- func (b *Broker) Unsubscribe(ctx context.Context, id string, p *packet.Unsubscribe) (*packet.UnsubAck, error)
- type Config
- type Job
- type Listener
- type PeerStore
- type Pool
- type STANMessage
- type SessionConfig
- type SessionStore
- type SubscriptionStore
- type TopicStore
Constants ¶
View Source
const ( EVENT_MESSAGE_PUBLISHED = "message_published" EVENT_STATE_UPDATED = "state_updated" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Broker ¶
type Broker struct { ID string Subscriptions SubscriptionStore Sessions SessionStore Topics TopicStore Peers PeerStore STANOutput chan STANMessage // contains filtered or unexported fields }
func (*Broker) Authenticate ¶
func (*Broker) CloseSession ¶ added in v0.0.32
func (*Broker) Disconnect ¶ added in v0.0.51
func (*Broker) DistributeMessage ¶ added in v0.0.37
func (b *Broker) DistributeMessage(message *pb.MessagePublished) error
func (*Broker) JoinServiceLayer ¶ added in v0.0.52
func (b *Broker) JoinServiceLayer(layer cluster.ServiceLayer)
func (*Broker) ListRetainedMessages ¶
func (b *Broker) ListRetainedMessages() (topics.RetainedMessageSet, error)
func (*Broker) ListSessions ¶
func (b *Broker) ListSessions() (sessions.SessionSet, error)
func (*Broker) ListSubscriptions ¶
func (b *Broker) ListSubscriptions() (subscriptions.SubscriptionSet, error)
func (*Broker) OnSessionClosed ¶
func (*Broker) OnSessionLost ¶
func (*Broker) OnUnsubscribe ¶
func (*Broker) RemoteRPCProvider ¶ added in v0.0.42
func (*Broker) RetainThenDispatchToLocalSessions ¶ added in v0.0.18
func (*Broker) Start ¶ added in v0.0.51
func (broker *Broker) Start(layer cluster.ServiceLayer)
type Config ¶
type Config struct { NATSURL string AuthHelper func(transport transport.Metadata, sessionID []byte, username string, password string) (tenant string, err error) Session SessionConfig }
func DefaultConfig ¶
func DefaultConfig() Config
type STANMessage ¶ added in v0.0.30
type SessionConfig ¶ added in v0.0.9
type SessionConfig struct {
MaxInflightSize int
}
type SessionStore ¶
type SessionStore interface { ByID(id string) (sessions.Session, error) ByClientID(id string) (sessions.SessionSet, error) ByPeer(peer string) (sessions.SessionSet, error) All() (sessions.SessionSet, error) Exists(id string) bool Upsert(sess sessions.Session, transport sessions.Transport) error Delete(id, reason string) error On(event string, handler func(sessions.Session)) func() }
type SubscriptionStore ¶
type SubscriptionStore interface { ByTopic(tenant string, pattern []byte) (subscriptions.SubscriptionSet, error) ByID(id string) (subscriptions.Subscription, error) All() (subscriptions.SubscriptionSet, error) ByPeer(peer string) (subscriptions.SubscriptionSet, error) BySession(id string) (subscriptions.SubscriptionSet, error) Sessions() ([]string, error) Create(message subscriptions.Subscription, sender func(context.Context, packet.Publish) error) error Delete(id string) error On(event string, handler func(subscriptions.Subscription)) func() }
type TopicStore ¶
type TopicStore interface { Create(message topics.RetainedMessage) error ByTopicPattern(tenant string, pattern []byte) (topics.RetainedMessageSet, error) All() (topics.RetainedMessageSet, error) On(event string, handler func(topics.RetainedMessage)) func() }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.