Documentation
¶
Index ¶
- Variables
- type ErrEventReqChNotSet
- type ErrNewEvent
- type ErrUnregisteredEvent
- type Event
- type EventAccountCreatedPayload
- type EventInfo
- type EventMeta
- type EventName
- type EventPaymentPayload
- type EventPolicyUpdatedPayload
- type EventProductReservedPayload
- type EventPublisher
- type EventRegistry
- type EventUpsertPolicyPayload
- type IEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilNATSConnObj = errors.New("nil nats conn obj received") ErrInvalidPayload = errors.New("invalid payload") ErrUnsupportedEvent = errors.New("unsupported event") )
Errors of event package
View Source
var Registry = &EventRegistry{ Registry: make(map[EventName]EventInfo), }
Registry is the service EventRegistry where all the active events which are to be fired or handled must register themselves
Functions ¶
This section is empty.
Types ¶
type ErrEventReqChNotSet ¶
type ErrEventReqChNotSet struct {
Name EventName
}
func (*ErrEventReqChNotSet) Error ¶
func (e *ErrEventReqChNotSet) Error() string
type ErrNewEvent ¶
type ErrNewEvent struct {
Name EventName
}
func (*ErrNewEvent) Error ¶
func (e *ErrNewEvent) Error() string
type ErrUnregisteredEvent ¶
type ErrUnregisteredEvent struct {
Name EventName
}
func (*ErrUnregisteredEvent) Error ¶
func (e *ErrUnregisteredEvent) Error() string
type Event ¶
type Event struct {
Meta EventMeta `json:"meta"`
Payload interface{} `json:"payload"`
}
func (*Event) GetPayload ¶
func (e *Event) GetPayload() interface{}
type EventName ¶
type EventName string
const EventAccountCreated EventName = "EventAccountCreated"
const EventPayment EventName = "EventPayment"
const EventPolicyUpdated EventName = "EventPolicyUpdated"
const EventProductReserved EventName = "EventProductReserved"
const EventUpsertPolicy EventName = "EventUpsertPolicy"
type EventPaymentPayload ¶
type EventPublisher ¶
type EventPublisher struct {
// contains filtered or unexported fields
}
EventPublisher makes it easy to add events and send them all at once
func NewEventPublisher ¶
func NewEventPublisher() *EventPublisher
func (*EventPublisher) GetEventNames ¶
func (ep *EventPublisher) GetEventNames() (names []string)
func (*EventPublisher) Publish ¶
func (ep *EventPublisher) Publish(nc *nats.EncodedConn) error
Publish publishes the added events to registered NATS subjects if error occurs while publishing any event, the publisher returns the error immediately instead of try publishing other events
type EventRegistry ¶
Registry holds all the event name and their transport details mapping It helps in verifying the event name and getting their request/response channel
func (*EventRegistry) GetEventInfo ¶
func (er *EventRegistry) GetEventInfo(name EventName) (EventInfo, error)
Click to show internal directories.
Click to hide internal directories.