Documentation
¶
Index ¶
Examples ¶
Constants ¶
const (
DefaultInboxSize = 256
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel implements the jrpc2 Channel interface over a NATS connection.
func Dial ¶
Dial dials the specified nats url ("nats://...") and binds it to the provided subject with the given options.
Example ¶
channel, err := natschannel.Dial("nats://localhost:4222", "foo.bar") if err != nil { panic(err) } err = channel.Close()
Output:
func New ¶
New wraps the given nats.Conn to implement the Channel interface.
Example ¶
conn, err := nats.Connect("nats://localhost:4222") if err != nil { panic(err) } channel, err := natschannel.New(conn, "foo.bar") if err != nil { panic(err) } err = channel.Close()
Output:
func (*Channel) Close ¶
Close implements the corresponding method of the Channel interface. Any active subscriptions are drained, the inbox channel closed and then the connection closed.
type Option ¶
Option is a builder function for modifying Options.
func InboxSize ¶
InboxSize specifies the size of the msg inbox channel used for receiving responses.
func NatsOptions ¶
func NatsOptions(options ...nats.Option) Option
NatsOptions allows for passing nats.Option to the nats.Conn that is being dialed.
type Options ¶
Options represents a collection of options used for controlling how nats.Conn are created and how the resultant Channel is bound to the nats.Conn.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the default options for the Channel.