package
0.79.0-preview.4
Repository: https://github.com/vegaprotocol/vega.git
Documentation: pkg.go.dev
# README
Event bus
Add a new event
- Create a protobuf message to describe your event in the
proto
folder. - Register your event in
BusEventType
enum andBusEvent.event
message inproto/events.proto
. - Generate the code with
make proto
. - In
events/bus.go
, create a constant to identify the event and map it to the protobuf enum typeBusEventType
in variableprotoMap
andtoProto
. Give it a name ineventStrings
. - In the
events
folder, create a filemy_event.go
where the Golang definition of the new event will live:
package events
import (
eventspb "code.vegaprotocol.io/vega/protos/vega/events/v1"
)
type MyEvent struct {
*Base
o eventspb.MyEvent
}
- Implement the
StreamEvent
interface on it. - Implement the "FromStream interface on it.
- Add the support for this new event into the
Service
responsible for it. - Update the graphql structures in the data-node in schema.graphql. In particular the
BusEventType
enum and theEvent
union