Documentation ¶
Overview ¶
Package nats provides an implementation for the flow pub/sub interface which uses NATS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn represents a connection to a NATS server.
func Connect ¶
Connect connects to the NATS servers with the given addresses. Address formats follow the NATS convention. For multiple addresses addr should contain a comma separated list.
func (Conn) Subscribe ¶
func (c Conn) Subscribe(ctx context.Context, stream, group string, h flow.PubSubHandler) (flow.Subscription, error)
Subscribe installs a handler for the specified stream. The handler shares the incoming message stream with other handlers of the same group. If the group is empty, a separate stream will be assigned to the handler.
type Option ¶
Option represents an option to configure NATS connections.
func ClientName ¶
ClientName defines a name for the connected client.
func Credentials ¶
Credentials sets the credentials which should be used for a server connection. If the given credentials are of the form "user:password", an user/password pair will be configured. Otherwise a security token is set. This option can be used twice, for the user/password pair and for the token.
func Reconnects ¶
Reconnects enables or disables reconnections to the NATS servers. The count parameter specifies the maximum number of reconnect attempts, while the interval specifies the wait time between those attempts. If count is zero, reconnections will be disabled. Otherwise, the reconnections will be enabled.
func TLSFromFiles ¶
TLSFromFiles enables secure connections to the NATS servers by loading a key pair from the given files.