Codebase list golang-github-go-kit-kit / 0c243515-0bf2-4b25-8735-9c1038fa7c1b/v0.9.0 transport / nats / request_response_funcs.go
0c243515-0bf2-4b25-8735-9c1038fa7c1b/v0.9.0

Tree @0c243515-0bf2-4b25-8735-9c1038fa7c1b/v0.9.0 (Download .tar.gz)

request_response_funcs.go @0c243515-0bf2-4b25-8735-9c1038fa7c1b/v0.9.0raw · history · blame

package nats

import (
	"context"

	"github.com/nats-io/nats.go"
)

// 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 RequestFunc func(context.Context, *nats.Msg) context.Context

// 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.
type SubscriberResponseFunc func(context.Context, *nats.Conn) context.Context

// 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.
type PublisherResponseFunc func(context.Context, *nats.Msg) context.Context