Package nats provides a NATS transport.
This section is empty.
This section is empty.
DefaultErrorEncoder writes the error to the subscriber reply.
EncodeJSONRequest is an EncodeRequestFunc that serializes the request as a JSON object to the Data of the Msg. Many JSON-over-NATS services can use it as a sensible default.
EncodeJSONResponse is a EncodeResponseFunc that serializes the response as a JSON object to the subscriber reply. Many JSON-over services can use it as a sensible default.
NopRequestDecoder is a DecodeRequestFunc that can be used for requests that do not need to be decoded, and simply returns nil, nil.
DecodeRequestFunc extracts a user-domain request object from a publisher request object. It's designed to be used in NATS subscribers, for subscriber-side endpoints. One straightforward DecodeRequestFunc could be something that JSON decodes from the request body to the concrete response type.
DecodeResponseFunc extracts a user-domain response object from an NATS response object. It's designed to be used in NATS publisher, for publisher-side endpoints. One straightforward DecodeResponseFunc could be something that JSON decodes from the response payload to the concrete response type.
EncodeRequestFunc encodes the passed request object into the NATS request object. It's designed to be used in NATS publishers, for publisher-side endpoints. One straightforward EncodeRequestFunc could something that JSON encodes the object directly to the request payload.
EncodeResponseFunc encodes the passed response object to the subscriber reply. It's designed to be used in NATS subscribers, for subscriber-side endpoints. One straightforward EncodeResponseFunc could be something that JSON encodes the object directly to the response body.
ErrorEncoder is responsible for encoding an error to the subscriber reply. Users are encouraged to use custom ErrorEncoders to encode errors to their replies, and will likely want to pass and check for their own error types.
type Publisher struct { }
Publisher wraps a URL and provides a method that implements endpoint.Endpoint.
NewPublisher constructs a usable Publisher for a single remote method.
Endpoint returns a usable endpoint that invokes the remote endpoint.
PublisherOption sets an optional parameter for clients.
PublisherAfter sets the ClientResponseFuncs applied to the incoming NATS request prior to it being decoded. This is useful for obtaining anything off of the response and adding onto the context prior to decoding.
PublisherBefore sets the RequestFuncs that are applied to the outgoing NATS request before it's invoked.
PublisherTimeout sets the available timeout for NATS request.
PublisherResponseFunc may take information from an NATS request and make the response available for consumption. ClientResponseFuncs are only executed in clients, after a request has been made, but prior to it being decoded.
RequestFunc may take information from a publisher request and put it into a request context. In Subscribers, RequestFuncs are executed prior to invoking the endpoint.
type Subscriber struct { }
Subscriber wraps an endpoint and provides nats.MsgHandler.
NewSubscriber constructs a new subscriber, which provides nats.MsgHandler and wraps the provided endpoint.
func (s Subscriber) ServeMsg(nc *nats.Conn) func(msg *nats.Msg)
ServeMsg provides nats.MsgHandler.
SubscriberFinalizerFunc can be used to perform work at the end of an request from a publisher, after the response has been written to the publisher. The principal intended use is for request logging.
SubscriberOption sets an optional parameter for subscribers.
SubscriberAfter functions are executed on the subscriber reply after the endpoint is invoked, but before anything is published to the reply.
SubscriberBefore functions are executed on the publisher request object before the request is decoded.
SubscriberErrorEncoder is used to encode errors to the subscriber reply whenever they're encountered in the processing of a request. Clients can use this to provide custom error formatting. By default, errors will be published with the DefaultErrorEncoder.
func SubscriberErrorHandler ΒΆ added in v0.9.0SubscriberErrorHandler is used to handle non-terminal errors. By default, non-terminal errors are ignored. This is intended as a diagnostic measure. Finer-grained control of error handling, including logging in more detail, should be performed in a custom SubscriberErrorEncoder which has access to the context.
SubscriberErrorLogger is used to log non-terminal errors. By default, no errors are logged. This is intended as a diagnostic measure. Finer-grained control of error handling, including logging in more detail, should be performed in a custom SubscriberErrorEncoder which has access to the context. Deprecated: Use SubscriberErrorHandler instead.
SubscriberFinalizer is executed at the end of every request from a publisher through NATS. By default, no finalizer is registered.
SubscriberResponseFunc may take information from a request context and use it to manipulate a Publisher. SubscriberResponseFuncs are only executed in subscribers, after invoking the endpoint but prior to publishing a reply.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4