-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages.go
36 lines (25 loc) · 824 Bytes
/
messages.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
32
33
34
35
36
package paymentspb
import (
"github.com/ibiscum/Event-Driven-Architecture-in-Golang/internal/registry"
"github.com/ibiscum/Event-Driven-Architecture-in-Golang/internal/registry/serdes"
)
const (
InvoiceAggregateChannel = "mallbots.payments.events.Invoice"
InvoicePaidEvent = "paymentsapi.InvoicePaid"
CommandChannel = "mallbots.payments.commands"
ConfirmPaymentCommand = "paymentsapi.ConfirmPayment"
)
func Registrations(reg registry.Registry) (err error) {
serde := serdes.NewProtoSerde(reg)
// Invoice events
if err = serde.Register(&InvoicePaid{}); err != nil {
return err
}
// commands
if err = serde.Register(&ConfirmPayment{}); err != nil {
return
}
return
}
func (*InvoicePaid) Key() string { return InvoicePaidEvent }
func (*ConfirmPayment) Key() string { return ConfirmPaymentCommand }