Documentation ¶
Index ¶
- Constants
- func SetRawMessage(ctx context.Context, msg Message) context.Context
- func SetRawMessages(ctx context.Context, msgs []Message) context.Context
- type Acknowledger
- type BatchConsumer
- type BatchConsumerFunc
- type BatchConsumerInterceptor
- type BeginTag
- type Config
- type ConsumeBeginTag
- type ConsumeEnd
- type Consumer
- type ConsumerFunc
- type ConsumerInterceptor
- type Dequeue
- type End
- type Engine
- type EnqueueTag
- type Logger
- type Message
- type NopStatsHandler
- type Option
- func WithAckImmediately() Option
- func WithBatchConsumerInterceptors(interceptors ...BatchConsumerInterceptor) Option
- func WithChunkSize(size int) Option
- func WithConsumerInterceptors(interceptors ...ConsumerInterceptor) Option
- func WithFlushInterval(inval time.Duration) Option
- func WithLogger(logger Logger) Option
- func WithStatsHandler(sh StatsHandler) Option
- type Stats
- type StatsHandler
- type Subscriber
- type Tag
Constants ¶
const ( // DefaultChunkSize is the default maximum chunked message size per consuming. DefaultChunkSize = 4 // DefaultFlushInterval is the default maximum flush interval to receive messages. DefaultFlushInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func SetRawMessage ¶ added in v0.5.0
Types ¶
type Acknowledger ¶
type Acknowledger interface { Ack() Nack() }
Acknowledger is an interface to send ACK/NACK.
type BatchConsumer ¶ added in v0.2.0
BatchConsumer represents an interface that consume multiple messages.
type BatchConsumerFunc ¶ added in v0.2.0
BatchConsumerFunc type is an adapter to allow the use of ordinary functions as BatchConsumer.
func (BatchConsumerFunc) BatchConsume ¶ added in v0.2.0
func (f BatchConsumerFunc) BatchConsume(ctx context.Context, msgs []Message) error
BatchConsume call f(ctx, msgs)
type BatchConsumerInterceptor ¶ added in v0.2.0
type BatchConsumerInterceptor func(BatchConsumer) BatchConsumer
BatchConsumerInterceptor provides a hook to intercept the execution of a multiple messages consumption.
type Config ¶
type Config struct { ChunkSize int AckImmediately bool FlushInterval time.Duration Logger Logger StatsHandler StatsHandler BatchConsumer BatchConsumer BatchConsumerInterceptors []BatchConsumerInterceptor Consumer Consumer ConsumerInterceptors []ConsumerInterceptor }
Config represents the configuration for subee.
type ConsumeEnd ¶
ConsumeEnd contains stats when consume end.
type ConsumerFunc ¶ added in v0.2.0
ConsumerFunc type is an adapter to allow the use of ordinary functions as Consumer.
type ConsumerInterceptor ¶ added in v0.2.0
ConsumerInterceptor provides a hook to intercept the execution of a message consumption.
type Engine ¶
type Engine struct { *Config // contains filtered or unexported fields }
Engine is the framework instance.
func New ¶ added in v0.2.0
func New(subscriber Subscriber, consumer Consumer, opts ...Option) *Engine
New creates a Engine intstance with Consumer.
func NewBatch ¶ added in v0.2.0
func NewBatch(subscriber Subscriber, consumer BatchConsumer, opts ...Option) *Engine
NewBatch creates a Engine intstance with BatchConsumer.
type Logger ¶
type Logger interface { Printf(format string, v ...interface{}) Print(v ...interface{}) }
Logger is the interface for logging
type Message ¶
type Message interface { Acknowledger Data() []byte Metadata() map[string]string }
Message is an interface of the subscribed message.
func GetRawMessage ¶ added in v0.5.0
func GetRawMessages ¶ added in v0.5.0
type NopStatsHandler ¶
type NopStatsHandler struct{}
NopStatsHandler is no-op StatsHandler
func (*NopStatsHandler) HandleProcess ¶
func (*NopStatsHandler) HandleProcess(context.Context, Stats)
HandleProcess do nothing
func (*NopStatsHandler) TagProcess ¶
TagProcess returns context without doing anythig
type Option ¶
type Option func(*Config)
Option configures Config.
func WithAckImmediately ¶
func WithAckImmediately() Option
WithAckImmediately returns an Option that make ack messages before consuming.
func WithBatchConsumerInterceptors ¶ added in v0.2.0
func WithBatchConsumerInterceptors(interceptors ...BatchConsumerInterceptor) Option
WithBatchConsumerInterceptors returns an Option that sets the BatchConsumerInterceptor implementations(s). Interceptors are called in order of addition. e.g) interceptor1, interceptor2, interceptor3 => interceptor1 => interceptor2 => interceptor3 => BatchConsumer.Consume
func WithChunkSize ¶
WithChunkSize returns an Option that sets the maximum chunked message size per consuming.
func WithConsumerInterceptors ¶ added in v0.2.0
func WithConsumerInterceptors(interceptors ...ConsumerInterceptor) Option
WithConsumerInterceptors returns an Option that sets the ConsumerInterceptor implementations(s). Interceptors are called in order of addition. e.g) interceptor1, interceptor2, interceptor3 => interceptor1 => interceptor2 => interceptor3 => Consumer.Consume
func WithFlushInterval ¶
WithFlushInterval returns an Option that sets the maximum flush time interval to receive message.
func WithLogger ¶
WithLogger returns an Option that sets the Logger implementation.
func WithStatsHandler ¶
func WithStatsHandler(sh StatsHandler) Option
WithStatsHandler returns an Option that sets the StatsHandler implementation.
type Stats ¶
type Stats interface {
// contains filtered or unexported methods
}
Stats is stats information about receive/consume.
type StatsHandler ¶
type StatsHandler interface { TagProcess(context.Context, Tag) context.Context HandleProcess(context.Context, Stats) }
StatsHandler is the interface for related stats handling
type Subscriber ¶
Subscriber is the interface to subscribe message.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
subee
Module
|
|
middlewares
|
|
logging/zap
Module
|
|
recovery
Module
|
|
stats
|
|
newrelic
Module
|
|
subscribers
|
|
cloudpubsub
Module
|
|