package borealis import ( "fmt" "github.com/nats-io/nats.go" ) type Bus struct { NATS *nats.EncodedConn } func Connect(url string) (*Bus, error) { conn, err := nats.Connect(url) if err != nil { return nil, fmt.Errorf("failed to connect to the broker: %w", err) } encodedConn, err := nats.NewEncodedConn(conn, nats.JSON_ENCODER) // TODO if err != nil { return nil, fmt.Errorf("failed to configure the bus encoding: %w", err) } return &Bus{NATS: encodedConn}, nil }