Skip to content
A high-level event driven consumer/producer supporting various "dialects"
Go
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE fix: updated OS suggestion May 30, 2019
circuit feat: initial set-up release changes v0.3.0 Aug 15, 2019
dialects feat: improved mutex locks/unlocks Aug 22, 2019
examples feat: initial set-up release changes v0.3.0 Aug 15, 2019
middleware feat: initial set-up release changes v0.3.0 Aug 15, 2019
types feat: ignore method if message is not constructed Aug 16, 2019
vendor fix: updated vendor directory Jul 29, 2019
.gitignore feat: included dependencies in vendor Feb 11, 2019
.gitmodules refactoring: removed boilerplate Sep 27, 2018
.travis.yml Revert "fix: travis only test on push" Aug 16, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Jul 16, 2018
CONTRIBUTING.md Create CONTRIBUTING.md May 30, 2019
LICENSE refactoring: license owner change Oct 28, 2018
README.md feat: improved readability and correctness Sep 12, 2019
codecov.yml feat: improved codecov test coverage range Aug 16, 2019
doc.go fix: updated methods documentation Apr 15, 2019
go.mod feat: updated go mod Aug 16, 2019
go.sum feat: improved writer method definitions Aug 10, 2019
group.go feat: initial set-up release changes v0.3.0 Aug 15, 2019
group_test.go feat: improved tests Aug 16, 2019
main.go feat: improved context usage and stability, updated examples to match… Jul 29, 2019
retry.go fix: spelling checks Mar 15, 2019
retry_test.go feat: spelling checks Mar 15, 2019
types.go feat: initial set-up release changes v0.3.0 Aug 15, 2019
writer.go fix: check if err is nil Aug 21, 2019
writer_test.go feat: writer tests Aug 16, 2019

README.md

Commander 🚀

GoDoc Build Status Coverage Coverage Report

Commander is a high-level toolkit for writing event-driven applications, aims to be developer-friendly. Commander supports event-driven patterns such as CQRS and has support for different "dialects". Dialects allow Commander to communicate with different protocols.

📚 Usage and documentation

Please see godoc for detailed usage docs. Or check out the examples.

Getting started

Below is a simple consume, produce example using the Mock dialect. For more advanced code check out the examples on Github.

dialect := mock.NewDialect()
group := commander.NewGroup(
	commander.NewTopic("commands", dialect, commander.CommandMessage, commander.ConsumeMode),
	commander.NewTopic("event", dialect, commander.EventMessage, commander.ConsumeMode|commander.ProduceMode),
)

client, err := commander.NewClient(group)
if err != nil {
	// Handle the err
}

group.HandleFunc("example", commander.CommandTopic, func(message *commander.Message, writer commander.Writer) {
	writer.Event("created", 1, nil, nil)
})

command := commander.NewCommand("example", 1, nil, nil)
group.ProduceCommand(command)

Dialects

A dialect is the connector to a given protocol or infrastructure. A dialect needs to be defined when constructing a new commander instance. Commander comes shipped with a mocking dialect designed for testing purposes. Check out the dialects directory for the available dialects.

Event driven patterns

CQRS Command Query Responsibility Segregation. Is an event-driven pattern segregating read and write objects. Writes (commands) are used to instruct a state change, reads (events) are returned to represent the state change including the state change itself.

Event Sourcing ensures that every change to the state of an application is captured in an event object and that these event objects are themselves stored in the sequence they were applied for the same lifetime as the application state itself.

Bidirectional streaming where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like: for example, the server could wait to receive all the client messages before writing its responses, or it could alternately read a message then write a message, or some other combination of reads and writes. The order of messages in each stream is preserved.

Contributing

Thank you for your interest in contributing to Commander! ❤

Everyone is welcome to contribute, whether it's in the form of code, documentation, bug reports, feature requests, or anything else. We encourage you to experiment with the project and make contributions to help evolve it to meet your needs!

See the contributing guide for more details.

You can’t perform that action at this time.