dispatcher

package
v0.0.0-...-c02b23a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RecvCache int = 10000
	SendCache int = 10000
)
View Source
const RequestsPollerTopic = "requests-poller"

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	ID      string      `json:"id" toml:"id"`
	Name    string      `json:"name" toml:"name"`
	Address net.TCPAddr `json:"address" toml:"address"`
	// contains filtered or unexported fields
}

app

func New

func New(config *config.Configuration, logger hclog.Logger) *Dispatcher

create a new dispatcher app

func (*Dispatcher) AwaitStop

func (d *Dispatcher) AwaitStop() error

AwaitStop start the main program, blocking with sleep loop

func (*Dispatcher) NewNATSServer

func (d *Dispatcher) NewNATSServer() (Transport, error)

type GRPCServer

type GRPCServer struct {
	*grpc.Server
	// contains filtered or unexported fields
}

GRPCServer is the GRPC server for DNC Dispatcher. It handels all the requests comming down to the DNC

func (*GRPCServer) Close

func (rpc *GRPCServer) Close() error

Close the grpc connection

func (*GRPCServer) Ping

Ping implements the Ping Interface TODO not really needed, made for testing

func (*GRPCServer) Put

TODO move to domain and this should only call that function some one calls to the DNC to do some polling, add the message to the queue and wait for its return

type MessageBus

type MessageBus struct {
	// contains filtered or unexported fields
}

MessageBus

type NATSServer

type NATSServer struct {
	*nats.Conn
	// contains filtered or unexported fields
}

func (*NATSServer) Close

func (nats *NATSServer) Close() error

func (*NATSServer) Ping

func (*NATSServer) Put

func (nats *NATSServer) Put(ctx context.Context, req *transport.Message) (*transport.Message, error)

Mock interface implementation, all logic is in subscription handler function in NewNATSServer method

type Transport

type Transport interface {
	Put(ctx context.Context, request *transport.Message) (*transport.Message, error)
	Ping(ctx context.Context, request *dispatcher.PingRequest) (*dispatcher.PingReply, error)
	Close() error
}

Transport is the interface that creates transportation between the dispatcher and the rest of the world. TODO request should be implemented through other means also: NATS, KAFKA, etc

func NewGRPCServer

func NewGRPCServer(port int, sendChan chan *transport.Message, logger *logrus.Logger) (Transport, error)

NewGRPCServer creates a new GRPC Server and returns the Transport interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL