Documentation ¶
Index ¶
- Constants
- func Bootstrap()
- type AddressNATS
- func NewAddress(topic string, addresses ...string) *AddressNATS
- func NewAddressForContact(contact dto_discovery.Contact) (*AddressNATS, error)
- func NewAddressGenerate(brokerIP string, myID identity.Identity) *AddressNATS
- func NewAddressWithConnection(connection nats.Connection, topic string) *AddressNATS
- type ContactNATSV1
Constants ¶
const ( BrokerPort = 4222 BrokerMaxReconnect = -1 BrokerReconnectWait = 4 * time.Second BrokerTimeout = 5 * time.Second )
Broker Constants
const TypeContactNATSV1 = "nats/v1"
TypeContactNATSV1 defines V1 format for NATS contact
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddressNATS ¶
type AddressNATS struct {
// contains filtered or unexported fields
}
AddressNATS structure defines details how NATS connection can be established
func NewAddress ¶
func NewAddress(topic string, addresses ...string) *AddressNATS
NewAddress creates NATS address to known host or cluster of hosts
func NewAddressForContact ¶
func NewAddressForContact(contact dto_discovery.Contact) (*AddressNATS, error)
NewAddressForContact extracts NATS address from given contact structure
func NewAddressGenerate ¶
func NewAddressGenerate(brokerIP string, myID identity.Identity) *AddressNATS
NewAddressGenerate generates NATS address for current node
func NewAddressWithConnection ¶
func NewAddressWithConnection(connection nats.Connection, topic string) *AddressNATS
NewAddressWithConnection constructs NATS address to already active NATS connection
func (*AddressNATS) Connect ¶
func (address *AddressNATS) Connect() (err error)
Connect establishes connection to broker
func (*AddressNATS) Disconnect ¶
func (address *AddressNATS) Disconnect()
Disconnect stops currently established connection
func (*AddressNATS) GetConnection ¶
func (address *AddressNATS) GetConnection() nats.Connection
GetConnection returns currently established connection
func (*AddressNATS) GetContact ¶
func (address *AddressNATS) GetContact() dto_discovery.Contact
GetContact serializes current address to Contact structure.
func (*AddressNATS) GetTopic ¶
func (address *AddressNATS) GetTopic() string
GetTopic returns topic. Address points to this topic in established connection.
type ContactNATSV1 ¶
type ContactNATSV1 struct { // Topic on which client is getting message Topic string `json:"topic"` // NATS servers used by node and should be contacted via BrokerAddresses []string `json:"broker_addresses"` }
ContactNATSV1 is definition of NATS contact