Documentation ¶
Overview ¶
Package pubsub contains several pubsub methods which implement common interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel interface { // Read and process incoming message. Read(model 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.
Subscribe function should return Channel interface but Go doesn't allow interface method to return another interface. So, you have to convert it first before using it.
See usage example in example folder.
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.