Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // SubTopicCtxKey is the key for the subscription topic. SubTopicCtxKey = subscriptionCtx("sub:topic") // SubIdCtxKey is the key for the subscription id. SubIdCtxKey = subscriptionCtx("sub:id") )
Functions ¶
func MarshalMessage ¶
MarshalMessage is a function that marshals input message structure into the pubsub.Message body.
Types ¶
type ChainHandler ¶
type ChainHandler struct { Middlewares Middlewares Endpoint Handler // contains filtered or unexported fields }
ChainHandler is a http.Handler with support for handler composition and execution.
type Handler ¶
Handler is an interface used by the Mux that is responsible for handling the Message.
type HandlerFunc ¶
HandlerFunc is a function used to handle messages.
type MessageTyper ¶ added in v0.0.6
type MessageTyper interface {
MessageType() string
}
MessageTyper is an interface used by the event messages that defines the type of the message.
type Middleware ¶
Middleware is a middleware function type.
type Middlewares ¶
type Middlewares []Middleware
Middlewares is a slice of middlewares.
func (Middlewares) Handler ¶
func (mws Middlewares) Handler(h Handler) Handler
func (Middlewares) HandlerFunc ¶
func (mws Middlewares) HandlerFunc(h HandlerFunc) Handler
type Topic ¶
type Topic interface { Send(ctx context.Context, m *pubsub.Message) error Shutdown(ctx context.Context) error ErrorAs(err error, i interface{}) bool As(i interface{}) bool }
Topic is the interface implementation of the pubsub.Topic. It allows to easily mockup the pubsub.Topic by replacing direct implementation.
type TopicPublisher ¶ added in v0.0.6
TopicPublisher is a structure responsible for publishing new topic messages.
func (*TopicPublisher) Publish ¶ added in v0.0.6
func (t *TopicPublisher) Publish(ctx context.Context, msg MessageTyper) error
Publish prepares pubsub.Message with the context stored metadata and publishes into given topic.
Directories ¶
Path | Synopsis |
---|---|
natsmiddleware
Module
|
|
Package pubsubmock is a generated GoMock package.
|
Package pubsubmock is a generated GoMock package. |