Documentation ¶
Index ¶
- Variables
- func CtxGetMessageSequence(ctx context.Context) (int64, bool)
- func CtxGetMessageTimestamp(ctx context.Context) (time.Time, bool)
- func CtxSetMessageSequence(ctx context.Context, seq int64) context.Context
- func CtxSetMessageTimestamp(ctx context.Context, timestamp time.Time) context.Context
- func MarshalMessage(c codec.Codec, msg interface{}) (*pubsub.Message, error)
- func UnmarshalMessage(c codec.Codec, msg *pubsub.Message, dst interface{}) error
- type ChainHandler
- type Handler
- type HandlerFunc
- type MessageTyper
- type Middleware
- type Middlewares
- type SubjectSubscription
- type Topic
- type TopicPublisher
Constants ¶
This section is empty.
Variables ¶
var ( // SubscriptionSubjectCtxKey is the key for the subscription topic. SubscriptionSubjectCtxKey = subscriptionCtx("pubsub:subject") // SubscriptionIdCtxKey is the key for the subscription id. SubscriptionIdCtxKey = subscriptionCtx("pubsub:id") // MessageTimestampKey is the key for the message timestamp. MessageTimestampKey = subscriptionCtx("pubsub:msg.timestamp") // MessageSequenceKey is the key for the message timestamp. MessageSequenceKey = subscriptionCtx("pubsub:msg.sequence") )
Functions ¶
func CtxGetMessageSequence ¶ added in v0.0.19
CtxGetMessageSequence gets the message sequence from the context.
func CtxGetMessageTimestamp ¶ added in v0.0.19
CtxGetMessageTimestamp gets the message timestamp from the context.
func CtxSetMessageSequence ¶ added in v0.0.19
CtxSetMessageSequence sets the message sequence in the context,
func CtxSetMessageTimestamp ¶ added in v0.0.19
CtxSetMessageTimestamp sets the message timestamp in the context.
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 SubjectSubscription ¶ added in v0.0.27
type SubjectSubscription struct { Subject string Subscription *pubsub.Subscription }
SubjectSubscription is the structure that contains both the subject and related subscription. It is used by the mux to define a human-readable version of the subscription. The subject should be the URL formatted subject of specific pubsub driver that matches given subscription.
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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package pubsubmock is a generated GoMock package.
|
Package pubsubmock is a generated GoMock package. |
pubsubmiddleware
|
|
natsmiddleware
Module
|
|