Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Claim ¶
type Claim interface {
// Err chan used to receive error
Err() <-chan error
// Message chan used to receive message content
Message() <-chan []byte
}
Claim used to receive requests from mq.
type Conn ¶
type Conn interface {
// Close closes the conn
Close() error
// Ping checks the connection to topic
Ping(topic string) error
// Subscribe subscribes topic with consumer
Subscribe(topic string, consumer Consumer) error
// Publish publishs message content to topic.
// content allowed to be modified after Publish called.
Publish(topic string, content []byte) error
}
Conn is the top-level mq connection
type Consumer ¶
type Consumer interface {
// Setup would be called before consumption loop
Setup() error
// Cleanup would be called after consumption loop
Cleanup() error
// Consume runs the consumption loop blocking
Consume(topic string, claim Claim)
}
Consumer used to consume received messages from mq.
type Driver ¶
type Driver interface {
// Open returns a Conn instance by a driver-specific source name
Open(source string, discovery discovery.Discovery) (Conn, error)
}
Driver is the interface that must be implemented by a mq driver
type FuncConsumer ¶
FuncConsumer implements Consumer interface
func (FuncConsumer) Cleanup ¶
func (fc FuncConsumer) Cleanup() error
Cleanup implements Consumer Cleanup method
func (FuncConsumer) Consume ¶
func (fc FuncConsumer) Consume(topic string, claim Claim)
Consume implements Consumer Consume method
func (FuncConsumer) Setup ¶
func (fc FuncConsumer) Setup() error
Setup implements Consumer Setup method
Click to show internal directories.
Click to hide internal directories.