Documentation ¶
Index ¶
- Variables
- type BrokerStreamServer
- func (s *BrokerStreamServer) Associate(stream Broker_AssociateServer) (err error)
- func (s *BrokerStreamServer) Publish(stream Broker_PublishServer) error
- func (s *BrokerStreamServer) SetLogger(logger log.Interface)
- func (s *BrokerStreamServer) Subscribe(req *SubscribeRequest, stream Broker_SubscribeServer) (err error)
- type Client
- type ClientConfig
- type HandlerStream
- type RouterStream
Constants ¶
This section is empty.
Variables ¶
var DefaultClientConfig = ClientConfig{ BackgroundContext: context.Background(), BufferSize: 10, }
DefaultClientConfig for broker Client
Functions ¶
This section is empty.
Types ¶
type BrokerStreamServer ¶
type BrokerStreamServer struct { RouterAssociateChanFunc func(md metadata.MD) (up chan *UplinkMessage, down <-chan *DownlinkMessage, cancel func(), err error) HandlerSubscribeChanFunc func(md metadata.MD) (ch <-chan *DeduplicatedUplinkMessage, cancel func(), err error) HandlerPublishChanFunc func(md metadata.MD) (ch chan *DownlinkMessage, err error) // contains filtered or unexported fields }
BrokerStreamServer handles gRPC streams as channels
func NewBrokerStreamServer ¶
func NewBrokerStreamServer() *BrokerStreamServer
NewBrokerStreamServer returns a new BrokerStreamServer
func (*BrokerStreamServer) Associate ¶
func (s *BrokerStreamServer) Associate(stream Broker_AssociateServer) (err error)
Associate handles uplink streams from and downlink streams to the router
func (*BrokerStreamServer) Publish ¶
func (s *BrokerStreamServer) Publish(stream Broker_PublishServer) error
Publish handles downlink streams from the handler
func (*BrokerStreamServer) SetLogger ¶
func (s *BrokerStreamServer) SetLogger(logger log.Interface)
SetLogger sets the logger
func (*BrokerStreamServer) Subscribe ¶
func (s *BrokerStreamServer) Subscribe(req *SubscribeRequest, stream Broker_SubscribeServer) (err error)
Subscribe handles uplink streams towards the handler
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for broker
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient creates a new Client with the given configuration
func (*Client) AddServer ¶
func (c *Client) AddServer(name string, conn *grpc.ClientConn)
AddServer adds a broker server
func (*Client) NewHandlerStreams ¶
func (c *Client) NewHandlerStreams(id string, token string) HandlerStream
NewHandlerStreams returns new streams using the given handler ID and token
func (*Client) NewRouterStreams ¶
func (c *Client) NewRouterStreams(id string, token string) RouterStream
NewRouterStreams returns new streams using the given router ID and token
type ClientConfig ¶
ClientConfig for broker Client
type HandlerStream ¶
type HandlerStream interface { Uplink() <-chan *DeduplicatedUplinkMessage Downlink(*DownlinkMessage) Close() }
HandlerStream is used for sending uplink and receiving downlink.
type RouterStream ¶
type RouterStream interface { Uplink(*UplinkMessage) Downlink() <-chan *DownlinkMessage Close() }
RouterStream is used for sending uplink and receiving downlink.