Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultIDGetter(msg *nats.Msg) (string, error)
- func GetPodSubject(subject string, instance string) string
- func GetSubscribeSubject(subject string) string
- func GetUnsubscribeSubject(subject string) string
- type Balancer
- func (b *Balancer) AddInstance(subject, instanceID string) error
- func (b *Balancer) DestroyInstance(instanceID string) error
- func (b *Balancer) Execute(subject, id string) (string, error)
- func (b *Balancer) GetAllInstances() []string
- func (b *Balancer) GetSubjectInstances(subject string) []string
- func (b *Balancer) RemoveInstance(subject, instanceID string) error
- type Client
- func (c *Client) PongListener(natsHandler *subscriber.Subscriber) error
- func (c *Client) RunAndWait(natsHandler *subscriber.Subscriber, checkEvery, maxPingDelay time.Duration, ...) error
- func (c *Client) ServiceHealthcheck(checkEvery, maxPingDelay time.Duration, stopFunction func())
- func (c *Client) Subscribe(ctx context.Context, subjectToSubscribe string) (string, error)
- func (c *Client) Unsubscribe(ctx context.Context, subjectToUnsubscribe string) error
- type EasyJSON_exporter_Subscribe
- type EasyJSON_exporter_Unsubscribe
- type NATSPopulator
- type NATSPublisher
- type NATSRequester
- type Ping
- type Server
- func (s *Server) GetInstances() []string
- func (s *Server) Process(natsHandler *subscriber.Subscriber) error
- func (s *Server) ProcessWithGetter(natsHandler *subscriber.Subscriber, ...) error
- func (s *Server) Proxy(subject string) func(ctx context.Context, msg *nats.Msg) error
- func (s *Server) ProxyWithGetter(subject string, idGetter func(msg *nats.Msg) (string, error)) func(ctx context.Context, msg *nats.Msg) error
- func (s *Server) Subscribe(_ context.Context, msg *nats.Msg) error
- func (s *Server) Unsubscribe(_ context.Context, msg *nats.Msg) error
- type Storage
- type Subscribe
- type Unsubscribe
Constants ¶
View Source
const ( HeaderID = "id" PingMsg = "PING" PongMsg = "PONG" )
Variables ¶
Functions ¶
func DefaultIDGetter ¶
func GetPodSubject ¶
func GetSubscribeSubject ¶
func GetUnsubscribeSubject ¶
Types ¶
type Balancer ¶
type Balancer struct {
// contains filtered or unexported fields
}
Balancer is responsible to control right balance between services
func NewBalancer ¶
func (*Balancer) AddInstance ¶
func (*Balancer) DestroyInstance ¶
func (*Balancer) GetAllInstances ¶
func (*Balancer) GetSubjectInstances ¶
func (*Balancer) RemoveInstance ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(client NATSPopulator, proxyServiceSubject string, instanceGetter func() string) *Client
func (*Client) PongListener ¶
func (c *Client) PongListener(natsHandler *subscriber.Subscriber) error
func (*Client) RunAndWait ¶
func (c *Client) RunAndWait( natsHandler *subscriber.Subscriber, checkEvery, maxPingDelay time.Duration, stopFunction func(), ) error
func (*Client) ServiceHealthcheck ¶
type EasyJSON_exporter_Subscribe ¶
type EasyJSON_exporter_Subscribe *Subscribe
type EasyJSON_exporter_Unsubscribe ¶
type EasyJSON_exporter_Unsubscribe *Unsubscribe
type NATSPopulator ¶
type NATSPopulator interface { NATSPublisher NATSRequester }
type NATSPublisher ¶
type NATSRequester ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServerWithStorage ¶
func NewServerWithStorage(storage Storage, client NATSPublisher, subject string, subjects []string) *Server
func (*Server) GetInstances ¶
func (*Server) Process ¶
func (s *Server) Process(natsHandler *subscriber.Subscriber) error
func (*Server) ProcessWithGetter ¶
func (s *Server) ProcessWithGetter( natsHandler *subscriber.Subscriber, idGetter func(msg *nats.Msg) (string, error), ) error
func (*Server) ProxyWithGetter ¶
type Subscribe ¶
func (Subscribe) MarshalEasyJSON ¶
func (Subscribe) MarshalJSON ¶
func (*Subscribe) UnmarshalEasyJSON ¶
func (*Subscribe) UnmarshalJSON ¶
type Unsubscribe ¶
func (Unsubscribe) MarshalEasyJSON ¶
func (Unsubscribe) MarshalEasyJSON(w *jwriter.Writer)
func (Unsubscribe) MarshalJSON ¶
func (Unsubscribe) MarshalJSON() ([]byte, error)
func (*Unsubscribe) UnmarshalEasyJSON ¶
func (*Unsubscribe) UnmarshalEasyJSON(l *jlexer.Lexer)
func (*Unsubscribe) UnmarshalJSON ¶
func (*Unsubscribe) UnmarshalJSON([]byte) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.