-
Notifications
You must be signed in to change notification settings - Fork 5
/
doc.go
31 lines (25 loc) · 1003 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Package commander is a 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.
import (
"github.com/jeroenrinzema/commander"
"github.com/jeroenrinzema/commander/dialects/mock"
)
func main() {
dialect := mock.NewDialect()
group := commander.NewGroup(
NewTopic("commands", dialect, commander.CommandMessage, commander.ConsumeMode),
NewTopic("event", dialect, commander.EventMessage, commander.ConsumeMode|commander.ProduceMode),
)
client := commander.NewClient(group)
defer client.Close()
group.HandleFunc("example", commander.CommandTopic, func(writer commander.ResponseWriter, message interface{}) {
writer.ProduceEvent("created", 1, uuid.Nil, nil)
})
command := commander.NewCommand("example", 1, uuid.Nil, nil)
group.ProduceCommand(command)
// ...
}
*/
package commander