SkillAgentSearch skills...

Pubsub

Simple PubSub interface for golang apps with plugable drivers

Install / Use

/learn @gocontrib/Pubsub
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Build Status

pubsub

Simple PubSub interface for golang apps with plugable drivers.

Supported drivers

  • in-memory implementation based on go channels
  • nats.io
  • redis using redigo
  • nsq.io - draft, not completed!

API

API is pretty simple

// Hub interface of pubsub system.
type Hub interface {
	// Publish sends input message to specified channels.
	Publish(channels []string, msg interface{})
	// Subscribe opens channel to listen specified channels.
	Subscribe(channels []string) (Channel, error)
	// Close stops the pubsub hub.
	Close() error
}

// Channel to listen pubsub events.
type Channel interface {
	// Read returns channel to receive events.
	Read() <-chan interface{}
	// Close stops listening underlying pubsub channels.
	Close() error
	// CloseNotify returns channel to receive event when this channel is closed.
	CloseNotify() <-chan bool
}

Server-sent events

See code of built-in package

TODO

  • [x] continuous integration
  • [ ] (in progress) unit tests
  • [ ] example for websocket event streams
  • [x] remove dependency on "github.com/drone/config" module
  • [ ] get working nsq driver
  • [ ] find and implement more drivers maybe faster then nats.io
View on GitHub
GitHub Stars4
CategoryDevelopment
Updated3y ago
Forks0

Languages

Go

Security Score

70/100

Audited on Feb 4, 2023

No findings