Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidPubsubType = errors.New("invalid pubsub type")
ErrInvalidPubsubType is error for invalid pubsub type.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel interface { // Read and process incoming message. Param `data` should // be a pointer just like when using json.Unmarshal. Read(data interface{}) (<-chan interface{}, <-chan error) // Close subscription. Close() error }
Channel is channel interface.
See usage example in example folder.
type PubSub ¶
type PubSub interface { // Publish message to specific topic/channel. // Data will be encoded first before publishing. Publish(topic string, data interface{}) error // Subscribe to specific topic/channel. Subscribe(topic string) (interface{}, error) // Close pubsub client connection. Close() error }
PubSub is pubsub interface.
For subscribe function, you have to convert the return type to Channel.
See usage example in example folder.
type PubsubType ¶
type PubsubType int8
PubsubType is type for pubsub.
const ( Redis PubsubType = iota + 1 RabbitMQ NSQ )
Available types for pubsub.
Directories ¶
Path | Synopsis |
---|---|
Package nsq is a wrapper of the original "github.com/nsqio/go-nsq" library.
|
Package nsq is a wrapper of the original "github.com/nsqio/go-nsq" library. |
Package rabbitmq is a wrapper of the original "github.com/streadway/amqp" library.
|
Package rabbitmq is a wrapper of the original "github.com/streadway/amqp" library. |
Package redis is a wrapper of the original "github.com/go-redis/redis/v8" library.
|
Package redis is a wrapper of the original "github.com/go-redis/redis/v8" library. |
Click to show internal directories.
Click to hide internal directories.