All Projects → italolelis → outboxer

italolelis / outboxer

Licence: MIT license
A library that implements the outboxer pattern in go

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to outboxer

Fluentdispatch
🌊 .NET Standard 2.1 framework which makes easy to scaffold distributed systems and dispatch incoming load into units of work in a deterministic way.
Stars: ✭ 152 (+68.89%)
Mutual labels:  distributed-systems, resiliency
retry-go
Retrying made simple and easy for golang 🔁
Stars: ✭ 43 (-52.22%)
Mutual labels:  distributed-systems, resiliency
Ddd
A Domain Driven Design framework for software simplicity in node
Stars: ✭ 244 (+171.11%)
Mutual labels:  distributed-systems
fabric
Fabric is an experimental protocol for exchanging information.
Stars: ✭ 46 (-48.89%)
Mutual labels:  distributed-systems
rce
Distributed, workflow-driven integration environment
Stars: ✭ 42 (-53.33%)
Mutual labels:  distributed-systems
Advanced Java
😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识
Stars: ✭ 59,142 (+65613.33%)
Mutual labels:  distributed-systems
go-distsys
Distributed Systems programming examples in the Go programming language.
Stars: ✭ 101 (+12.22%)
Mutual labels:  distributed-systems
Erleans
Erlang Orleans
Stars: ✭ 239 (+165.56%)
Mutual labels:  distributed-systems
Garfield
An offensive attack framework for Distributed Layer of Modern Applications
Stars: ✭ 74 (-17.78%)
Mutual labels:  distributed-systems
aether
Distributed system emulation in Common Lisp
Stars: ✭ 19 (-78.89%)
Mutual labels:  distributed-systems
logserver
web log viewer that combines logs from several sources
Stars: ✭ 20 (-77.78%)
Mutual labels:  distributed-systems
Distributed-Algorithms
利用 Go 语言实现多种分布式算法
Stars: ✭ 53 (-41.11%)
Mutual labels:  distributed-systems
istio-talk
A talk on Istio and related demos
Stars: ✭ 11 (-87.78%)
Mutual labels:  resiliency
quartz-scheduler-hazelcast-jobstore
An implementation of a Quartz Scheduler JobStore using Hazelcast distributed Collections
Stars: ✭ 42 (-53.33%)
Mutual labels:  distributed-systems
Jehanne
Jehanne Operating System
Stars: ✭ 248 (+175.56%)
Mutual labels:  distributed-systems
kraken
Chaos and resiliency testing tool for Kubernetes and OpenShift
Stars: ✭ 161 (+78.89%)
Mutual labels:  resiliency
Suod
(MLSys' 21) An Acceleration System for Large-scare Unsupervised Heterogeneous Outlier Detection (Anomaly Detection)
Stars: ✭ 245 (+172.22%)
Mutual labels:  distributed-systems
nebula
A distributed, fast open-source graph database featuring horizontal scalability and high availability
Stars: ✭ 8,196 (+9006.67%)
Mutual labels:  distributed-systems
ucz-dfs
A distributed file system written in Rust.
Stars: ✭ 25 (-72.22%)
Mutual labels:  distributed-systems
tutorial
Tutorials to help you build your first Swim app
Stars: ✭ 27 (-70%)
Mutual labels:  distributed-systems

Outboxer

Build Status codecov Go Report Card GoDoc

Outboxer is a go library that implements the outbox pattern.

Getting Started

Outboxer was designed to simplify the tough work of orchestrating message reliabilty. Essentially we are trying to solve this question:

How can producers reliably send messages when the broker/consumer is unavailable?

If you have a distributed system architecture and especially is dealing with Event Driven Architecture, you might want to use outboxer.

The first thing to do is include the package in your project

go get github.com/italolelis/outboxer

Initial Configuration

Let's setup a simple example where you are using RabbitMQ and Postgres as your outbox pattern components:

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

db, err := sql.Open("postgres", os.Getenv("DS_DSN"))
if err != nil {
    fmt.Printf("could not connect to amqp: %s", err)
    return
}

conn, err := amqp.Dial(os.Getenv("ES_DSN"))
if err != nil {
    fmt.Printf("could not connect to amqp: %s", err)
    return
}

// we need to create a data store instance first
ds, err := postgres.WithInstance(ctx, db)
if err != nil {
    fmt.Printf("could not setup the data store: %s", err)
    return
}
defer ds.Close()

// we create an event stream passing the amqp connection
es := amqpOut.NewAMQP(conn)

// now we create an outboxer instance passing the data store and event stream
o, err := outboxer.New(
    outboxer.WithDataStore(ds),
    outboxer.WithEventStream(es),
    outboxer.WithCheckInterval(1*time.Second),
    outboxer.WithCleanupInterval(5*time.Second),
    outboxer.WithCleanUpBefore(time.Now().AddDate(0, 0, -5)),
)
if err != nil {
    fmt.Printf("could not create an outboxer instance: %s", err)
    return
}

// here we initialize the outboxer checks and cleanup go rotines
o.Start(ctx)
defer o.Stop()

// finally we are ready to send messages
if err = o.Send(ctx, &outboxer.OutboxMessage{
    Payload: []byte("test payload"),
    Options: map[string]interface{}{
        amqpOut.ExchangeNameOption: "test",
        amqpOut.ExchangeTypeOption: "topic",
        amqpOut.RoutingKeyOption:   "test.send",
    },
}); err != nil {
    fmt.Printf("could not send message: %s", err)
    return
}

// we can also listen for errors and ok messages that were send
for {
    select {
    case err := <-o.ErrChan():
        fmt.Printf("could not send message: %s", err)
    case <-o.OkChan():
        fmt.Printf("message received")
        return
    }
}

Features

Outboxer comes with a few implementations of Data Stores and Event Streams.

Data Stores

Event Streams

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].