github.com/moleculer-go/moleculer@v0.3.3/transit/transit.go (about)

     1  package transit
     2  
     3  import (
     4  	"github.com/moleculer-go/moleculer"
     5  	"github.com/moleculer-go/moleculer/serializer"
     6  )
     7  
     8  type TransportHandler func(moleculer.Payload)
     9  
    10  type ValidateMsgFunc func(moleculer.Payload) bool
    11  
    12  type Transit interface {
    13  	Emit(moleculer.BrokerContext)
    14  	Request(moleculer.BrokerContext) chan moleculer.Payload
    15  	Connect() chan error
    16  	Disconnect() chan error
    17  	DiscoverNode(nodeID string)
    18  
    19  	//DiscoverNodes checks if there are neighbours and return true if any are found ;).
    20  	DiscoverNodes() chan bool
    21  	SendHeartbeat()
    22  }
    23  
    24  type Transport interface {
    25  	Connect() chan error
    26  	Disconnect() chan error
    27  	Subscribe(command, nodeID string, handler TransportHandler)
    28  	Publish(command, nodeID string, message moleculer.Payload)
    29  
    30  	SetPrefix(prefix string)
    31  	SetNodeID(nodeID string)
    32  	SetSerializer(serializer serializer.Serializer)
    33  }