Categorygithub.com/soyacen/easypubsub
modulepackage
0.0.0-20211026064719-2ba4c8db66aa
Repository: https://github.com/soyacen/easypubsub.git
Documentation: pkg.go.dev

# README

Easypubsub

Easypubsub implements the Pub/Sub message flow for Golang. Pub/Sub allows services to communicate asynchronously. Easypubsub also can build event driven applications.

Why Pub/Sub

  • Pub/Sub allows services to communicate asynchronously, with latencies on the order of 100 milliseconds.

  • Pub/Sub is used for streaming analytics and data integration pipelines to ingest and distribute data. It is equally effective as messaging-oriented middleware for service integration or as a queue to parallelize tasks.

  • Pub/Sub enables you to create systems of event producers and consumers, called publishers and subscribers. Publishers communicate with subscribers asynchronously by broadcasting events, rather than by synchronous remote procedure calls (RPCs).

  • Publishers send events to the Pub/Sub service, without regard to how or when these events will be processed. Pub/Sub then delivers events to all services that need to react to them. Compared to systems communicating through RPCs, where publishers must wait for subscribers to receive the data, such asynchronous integration increases the flexibility and robustness of the system overall.

Pub/Subs

Easypubsub provides universal interfaces for publisher and subscriber

type (
    PublishResult struct {
        Err    error
        Result interface{}
    }
    
    Publisher interface {
        Publish(topic string, msg *Message) (result *PublishResult)
        io.Closer
        fmt.Stringer
    }
)

type Subscriber interface {
    Subscribe(ctx context.Context, topic string) (<-chan *Message, <-chan error)
    io.Closer
    fmt.Stringer
}

Pipe

Pipe combines subscriber and Publisher, abstracts source and sink to process data streams,

Examples

kafka

rabbitmq

io

...

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
Join joins any number of Headers into a single Header.
NewHeader creates an Header.
NewHeaderWithMap creates an Header from a given key-value map.
NewHeaderWithPairs returns an Header formed by the mapping of key, value...
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

Header is a mapping from header keys to values.
No description provided by the author