Documentation ¶
Index ¶
Constants ¶
const Scheme = "natsstr"
Scheme is the URL scheme natspubsub registers its URLOpeners under on pubsub.DefaultMux.
Variables ¶
This section is empty.
Functions ¶
func OpenSubscription ¶
func OpenSubscription(nc stan.Conn, subject, queue string, oo ...stan.SubscriptionOption) (*pubsub.Subscription, error)
OpenSubscription returns a *pubsub.Subscription representing a NATS subscription. The subject is the NATS Subject to subscribe to; for more info, see https://nats.io/documentation/writing_applications/subjects.
func OpenTopic ¶
func OpenTopic(nc stan.Conn, subject string, _ *TopicOptions) (*pubsub.Topic, error)
OpenTopic returns a *pubsub.Topic for use with NATS Streaming Server. The subject is the NATS Subject; for more info, see https://nats.io/documentation/writing_applications/subjects.
Types ¶
type TopicOptions ¶
type TopicOptions struct { }
type URLOpener ¶
type URLOpener struct { // Connection to use for communication with the server. Connection stan.Conn // TopicOptions specifies the options to pass to OpenTopic. TopicOptions TopicOptions // SubscriptionOptions specifies the options to pass to OpenSubscription. SubscriptionOptions stan.SubscriptionOptions }
URLOpener opens NATS URLs like "natsstr://mysubject".
The URL host+path is used as the subject.
No query parameters are supported.
func (*URLOpener) OpenSubscriptionURL ¶
func (o *URLOpener) OpenSubscriptionURL(ctx context.Context, u *url.URL) (*pubsub.Subscription, error)
OpenSubscriptionURL opens a pubsub.Subscription based on u.